Skip to content

Commit

Permalink
setup main
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentBlanckaert committed Dec 12, 2024
1 parent 145deae commit e14c758
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
24 changes: 12 additions & 12 deletions tested/nat_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ def expression_representer(dumper, data):
return yaml.dump(yaml_object, sort_keys=False)


# if __name__ == "__main__":
# n = len(sys.argv)
# assert n > 1, "Expected atleast two argument (path to yaml file and language)."
#
# path = sys.argv[1]
# lang = sys.argv[2]
# new_yaml = parse_yaml(path)
# print(new_yaml)
# translated_dsl = translate_dsl(new_yaml, lang)
# yaml_string = convert_to_yaml(translated_dsl)
# print(yaml_string)
# _validate_dsl(_parse_yaml(yaml_string))
if __name__ == "__main__":
n = len(sys.argv)
assert n > 1, "Expected atleast two argument (path to yaml file and language)."

Check warning on line 207 in tested/nat_translation.py

View check run for this annotation

Codecov / codecov/patch

tested/nat_translation.py#L206-L207

Added lines #L206 - L207 were not covered by tests

path = sys.argv[1]
lang = sys.argv[2]
new_yaml = parse_yaml(path)
print(new_yaml)
translated_dsl = translate_dsl(new_yaml, lang)
yaml_string = convert_to_yaml(translated_dsl)
print(yaml_string)
_validate_dsl(_parse_yaml(yaml_string))

Check warning on line 216 in tested/nat_translation.py

View check run for this annotation

Codecov / codecov/patch

tested/nat_translation.py#L209-L216

Added lines #L209 - L216 were not covered by tests
6 changes: 4 additions & 2 deletions tests/test_dsl_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
StringTypes,
)
from tested.dsl import parse_dsl, translate_to_test_suite
from tested.dsl.translate_parser import load_schema_validator, _parse_yaml
from tested.nat_translation import translate_dsl, convert_to_yaml
from tested.dsl.translate_parser import _parse_yaml, load_schema_validator
from tested.nat_translation import convert_to_yaml, translate_dsl
from tested.serialisation import (
FunctionCall,
NumberType,
Expand Down Expand Up @@ -1321,6 +1321,7 @@ def test_editor_json_schema_is_valid():
assert isinstance(validator.schema, dict)
validator.check_schema(validator.schema)


def test_natural_translate_unit_test():
# Everywhere where !natural_language is used, it is mandatory to do so.
# Everywhere else it isn't.
Expand Down Expand Up @@ -1415,6 +1416,7 @@ def test_natural_translate_unit_test():
print(translated_yaml)
assert translated_yaml.strip() == translated_yaml_str


def test_natural_translate_io_test():
# Everywhere where !natural_language is used, it is mandatory to do so.
# Everywhere else it isn't.
Expand Down

0 comments on commit e14c758

Please sign in to comment.