Skip to content

Commit

Permalink
Tested an extra edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentBlanckaert committed Dec 13, 2024
1 parent 65fb097 commit e941ef6
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 60 deletions.
1 change: 1 addition & 0 deletions tested/nat_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def translate_contexts(contexts: list, language: str) -> list:
assert isinstance(context, dict)
key_to_set = "script" if "script" in context else "testcases"
raw_testcases = context.get(key_to_set)
print(raw_testcases)
assert isinstance(raw_testcases, list)
context[key_to_set] = translate_testcases(raw_testcases, language)
if "files" in context:
Expand Down
122 changes: 62 additions & 60 deletions tests/test_dsl_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,74 +1425,76 @@ def test_natural_translate_io_test():
- unit:
en: "Arguments"
nl: "Argumenten"
scripts:
- stdin:
en: "User"
nl: "Gebruiker"
arguments:
en: [ "input", "output" ]
nl: [ "invoer", "uitvoer" ]
stdout: !natural_language
en: "Hi User"
nl: "Hallo Gebruiker"
stderr: !natural_language
en: "Nothing to see here"
nl: "Hier is niets te zien"
exception: !natural_language
en: "Does not look good"
nl: "Ziet er niet goed uit"
- stdin:
en: "Friend"
nl: "Vriend"
arguments:
en: [ "input", "output" ]
nl: [ "invoer", "uitvoer" ]
stdout:
data:
en: "Hi Friend"
nl: "Hallo Vriend"
config:
ignoreWhitespace: true
stderr:
data:
cases:
- script:
- stdin:
en: "User"
nl: "Gebruiker"
arguments:
en: [ "input", "output" ]
nl: [ "invoer", "uitvoer" ]
stdout: !natural_language
en: "Hi User"
nl: "Hallo Gebruiker"
stderr: !natural_language
en: "Nothing to see here"
nl: "Hier is niets te zien"
config:
ignoreWhitespace: true
exception:
message:
exception: !natural_language
en: "Does not look good"
nl: "Ziet er niet goed uit"
types:
typescript: "ERROR"
- stdin:
en: "Friend"
nl: "Vriend"
arguments:
en: [ "input", "output" ]
nl: [ "invoer", "uitvoer" ]
stdout:
data:
en: "Hi Friend"
nl: "Hallo Vriend"
config:
ignoreWhitespace: true
stderr:
data:
en: "Nothing to see here"
nl: "Hier is niets te zien"
config:
ignoreWhitespace: true
exception:
message:
en: "Does not look good"
nl: "Ziet er niet goed uit"
types:
typescript: "ERROR"
""".strip()
translated_yaml_str = """
units:
- unit: Arguments
scripts:
- stdin: User
arguments:
- input
- output
stdout: Hi User
stderr: Nothing to see here
exception: Does not look good
- stdin: Friend
arguments:
- input
- output
stdout:
data: Hi Friend
config:
ignoreWhitespace: true
stderr:
data: Nothing to see here
config:
ignoreWhitespace: true
exception:
message: Does not look good
types:
typescript: ERROR
cases:
- script:
- stdin: User
arguments:
- input
- output
stdout: Hi User
stderr: Nothing to see here
exception: Does not look good
- stdin: Friend
arguments:
- input
- output
stdout:
data: Hi Friend
config:
ignoreWhitespace: true
stderr:
data: Nothing to see here
config:
ignoreWhitespace: true
exception:
message: Does not look good
types:
typescript: ERROR
""".strip()
parsed_yaml = _parse_yaml(yaml_str)
translated_dsl = translate_dsl(parsed_yaml, "en")
Expand Down

0 comments on commit e941ef6

Please sign in to comment.