From e14c7584270c609de64b32ec2efcbabef6682987 Mon Sep 17 00:00:00 2001 From: breblanc Date: Thu, 12 Dec 2024 18:29:50 +0100 Subject: [PATCH] setup main --- tested/nat_translation.py | 24 ++++++++++++------------ tests/test_dsl_yaml.py | 6 ++++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tested/nat_translation.py b/tested/nat_translation.py index b011496a..ed2aa02b 100644 --- a/tested/nat_translation.py +++ b/tested/nat_translation.py @@ -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)." + + 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)) diff --git a/tests/test_dsl_yaml.py b/tests/test_dsl_yaml.py index 54b03c4e..9101b16d 100644 --- a/tests/test_dsl_yaml.py +++ b/tests/test_dsl_yaml.py @@ -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, @@ -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. @@ -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.