aas-core-codegen 0.0.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aas_core_codegen/__init__.py +6 -0
- aas_core_codegen/__main__.py +8 -0
- aas_core_codegen/common.py +500 -0
- aas_core_codegen/cpp/__init__.py +1 -0
- aas_core_codegen/cpp/aas_common/__init__.py +6 -0
- aas_core_codegen/cpp/aas_common/_generate.py +713 -0
- aas_core_codegen/cpp/common.py +681 -0
- aas_core_codegen/cpp/constants/__init__.py +6 -0
- aas_core_codegen/cpp/constants/_generate.py +568 -0
- aas_core_codegen/cpp/description.py +654 -0
- aas_core_codegen/cpp/enhancing/__init__.py +4 -0
- aas_core_codegen/cpp/enhancing/_generate.py +993 -0
- aas_core_codegen/cpp/iteration/__init__.py +6 -0
- aas_core_codegen/cpp/iteration/_generate.py +2332 -0
- aas_core_codegen/cpp/jsonization/__init__.py +6 -0
- aas_core_codegen/cpp/jsonization/_generate.py +2619 -0
- aas_core_codegen/cpp/main.py +694 -0
- aas_core_codegen/cpp/naming.py +170 -0
- aas_core_codegen/cpp/optionaling.py +557 -0
- aas_core_codegen/cpp/pattern/__init__.py +6 -0
- aas_core_codegen/cpp/pattern/_generate.py +508 -0
- aas_core_codegen/cpp/revm/__init__.py +6 -0
- aas_core_codegen/cpp/revm/_generate.py +1149 -0
- aas_core_codegen/cpp/stringification/__init__.py +5 -0
- aas_core_codegen/cpp/stringification/_generate.py +955 -0
- aas_core_codegen/cpp/structure/__init__.py +7 -0
- aas_core_codegen/cpp/structure/_generate.py +1503 -0
- aas_core_codegen/cpp/transpilation.py +1383 -0
- aas_core_codegen/cpp/unrolling.py +159 -0
- aas_core_codegen/cpp/verification/__init__.py +6 -0
- aas_core_codegen/cpp/verification/_generate.py +3073 -0
- aas_core_codegen/cpp/visitation/__init__.py +6 -0
- aas_core_codegen/cpp/visitation/_generate.py +521 -0
- aas_core_codegen/cpp/wstringification/__init__.py +5 -0
- aas_core_codegen/cpp/wstringification/_generate.py +586 -0
- aas_core_codegen/cpp/xmlization/__init__.py +6 -0
- aas_core_codegen/cpp/xmlization/_generate.py +5373 -0
- aas_core_codegen/cpp/yielding.py +201 -0
- aas_core_codegen/csharp/__init__.py +1 -0
- aas_core_codegen/csharp/common.py +224 -0
- aas_core_codegen/csharp/constants/__init__.py +5 -0
- aas_core_codegen/csharp/constants/_generate.py +409 -0
- aas_core_codegen/csharp/copying/__init__.py +4 -0
- aas_core_codegen/csharp/copying/_generate.py +498 -0
- aas_core_codegen/csharp/description.py +1103 -0
- aas_core_codegen/csharp/enhancing/__init__.py +4 -0
- aas_core_codegen/csharp/enhancing/_generate.py +667 -0
- aas_core_codegen/csharp/jsonization/__init__.py +4 -0
- aas_core_codegen/csharp/jsonization/_generate.py +1630 -0
- aas_core_codegen/csharp/main.py +421 -0
- aas_core_codegen/csharp/naming.py +157 -0
- aas_core_codegen/csharp/reporting/__init__.py +4 -0
- aas_core_codegen/csharp/reporting/_generate.py +266 -0
- aas_core_codegen/csharp/stringification/__init__.py +4 -0
- aas_core_codegen/csharp/stringification/_generate.py +243 -0
- aas_core_codegen/csharp/structure/__init__.py +6 -0
- aas_core_codegen/csharp/structure/_generate.py +1341 -0
- aas_core_codegen/csharp/transpilation.py +990 -0
- aas_core_codegen/csharp/unrolling.py +211 -0
- aas_core_codegen/csharp/verification/__init__.py +6 -0
- aas_core_codegen/csharp/verification/_generate.py +1457 -0
- aas_core_codegen/csharp/visitation/__init__.py +5 -0
- aas_core_codegen/csharp/visitation/_generate.py +579 -0
- aas_core_codegen/csharp/xmlization/__init__.py +4 -0
- aas_core_codegen/csharp/xmlization/_generate.py +1980 -0
- aas_core_codegen/golang/__init__.py +1 -0
- aas_core_codegen/golang/aas_common/__init__.py +4 -0
- aas_core_codegen/golang/aas_common/_generate.py +152 -0
- aas_core_codegen/golang/common.py +303 -0
- aas_core_codegen/golang/constants/__init__.py +5 -0
- aas_core_codegen/golang/constants/_generate.py +339 -0
- aas_core_codegen/golang/description.py +501 -0
- aas_core_codegen/golang/enhancing/__init__.py +4 -0
- aas_core_codegen/golang/enhancing/_generate.py +527 -0
- aas_core_codegen/golang/jsonization/__init__.py +4 -0
- aas_core_codegen/golang/jsonization/_generate.py +1740 -0
- aas_core_codegen/golang/main.py +368 -0
- aas_core_codegen/golang/naming.py +412 -0
- aas_core_codegen/golang/pointering.py +631 -0
- aas_core_codegen/golang/reporting/__init__.py +4 -0
- aas_core_codegen/golang/reporting/_generate.py +218 -0
- aas_core_codegen/golang/stringification/__init__.py +4 -0
- aas_core_codegen/golang/stringification/_generate.py +394 -0
- aas_core_codegen/golang/structure/__init__.py +6 -0
- aas_core_codegen/golang/structure/_generate.py +1493 -0
- aas_core_codegen/golang/transpilation.py +1191 -0
- aas_core_codegen/golang/unrolling.py +159 -0
- aas_core_codegen/golang/verification/__init__.py +6 -0
- aas_core_codegen/golang/verification/_generate.py +1513 -0
- aas_core_codegen/golang/xmlization/__init__.py +4 -0
- aas_core_codegen/golang/xmlization/_generate.py +2507 -0
- aas_core_codegen/infer_for_schema/__init__.py +21 -0
- aas_core_codegen/infer_for_schema/_inline.py +693 -0
- aas_core_codegen/infer_for_schema/_len.py +527 -0
- aas_core_codegen/infer_for_schema/_pattern.py +311 -0
- aas_core_codegen/infer_for_schema/_set.py +394 -0
- aas_core_codegen/infer_for_schema/_stringify.py +201 -0
- aas_core_codegen/infer_for_schema/_types.py +135 -0
- aas_core_codegen/infer_for_schema/match.py +122 -0
- aas_core_codegen/intermediate/__init__.py +78 -0
- aas_core_codegen/intermediate/_hierarchy.py +397 -0
- aas_core_codegen/intermediate/_stringify.py +989 -0
- aas_core_codegen/intermediate/_translate.py +5128 -0
- aas_core_codegen/intermediate/_types.py +2901 -0
- aas_core_codegen/intermediate/construction.py +750 -0
- aas_core_codegen/intermediate/doc.py +344 -0
- aas_core_codegen/intermediate/pattern_verification.py +428 -0
- aas_core_codegen/intermediate/revm.py +985 -0
- aas_core_codegen/intermediate/type_inference.py +2266 -0
- aas_core_codegen/java/__init__.py +1 -0
- aas_core_codegen/java/common.py +197 -0
- aas_core_codegen/java/constants/__init__.py +5 -0
- aas_core_codegen/java/constants/_generate.py +334 -0
- aas_core_codegen/java/copying/__init__.py +4 -0
- aas_core_codegen/java/copying/_generate.py +502 -0
- aas_core_codegen/java/description.py +774 -0
- aas_core_codegen/java/enhancing/__init__.py +4 -0
- aas_core_codegen/java/enhancing/_generate.py +820 -0
- aas_core_codegen/java/generation/__init__.py +5 -0
- aas_core_codegen/java/generation/_generate.py +285 -0
- aas_core_codegen/java/jsonization/__init__.py +4 -0
- aas_core_codegen/java/jsonization/_generate.py +1472 -0
- aas_core_codegen/java/main.py +438 -0
- aas_core_codegen/java/naming.py +187 -0
- aas_core_codegen/java/optional.py +514 -0
- aas_core_codegen/java/reporting/__init__.py +4 -0
- aas_core_codegen/java/reporting/_generate.py +248 -0
- aas_core_codegen/java/stringification/__init__.py +4 -0
- aas_core_codegen/java/stringification/_generate.py +212 -0
- aas_core_codegen/java/structure/__init__.py +6 -0
- aas_core_codegen/java/structure/_generate.py +1767 -0
- aas_core_codegen/java/transpilation.py +1111 -0
- aas_core_codegen/java/verification/__init__.py +6 -0
- aas_core_codegen/java/verification/_generate.py +1536 -0
- aas_core_codegen/java/visitation/__init__.py +5 -0
- aas_core_codegen/java/visitation/_generate.py +689 -0
- aas_core_codegen/java/xmlization/__init__.py +4 -0
- aas_core_codegen/java/xmlization/_generate.py +2274 -0
- aas_core_codegen/jsonld/__init__.py +1 -0
- aas_core_codegen/jsonld/main.py +455 -0
- aas_core_codegen/jsonschema/__init__.py +1 -0
- aas_core_codegen/jsonschema/main.py +982 -0
- aas_core_codegen/main.py +245 -0
- aas_core_codegen/naming.py +133 -0
- aas_core_codegen/opcua/__init__.py +1 -0
- aas_core_codegen/opcua/main.py +1525 -0
- aas_core_codegen/opcua/naming.py +126 -0
- aas_core_codegen/parse/__init__.py +46 -0
- aas_core_codegen/parse/_rules.py +796 -0
- aas_core_codegen/parse/_stringify.py +532 -0
- aas_core_codegen/parse/_translate.py +3940 -0
- aas_core_codegen/parse/_types.py +973 -0
- aas_core_codegen/parse/retree/__init__.py +46 -0
- aas_core_codegen/parse/retree/_fix.py +434 -0
- aas_core_codegen/parse/retree/_parse.py +1143 -0
- aas_core_codegen/parse/retree/_render.py +298 -0
- aas_core_codegen/parse/retree/_stringify.py +199 -0
- aas_core_codegen/parse/retree/_types.py +362 -0
- aas_core_codegen/parse/retree/_visitor.py +70 -0
- aas_core_codegen/parse/tree.py +1303 -0
- aas_core_codegen/protobuf/__init__.py +1 -0
- aas_core_codegen/protobuf/common.py +225 -0
- aas_core_codegen/protobuf/description.py +1102 -0
- aas_core_codegen/protobuf/main.py +115 -0
- aas_core_codegen/protobuf/naming.py +143 -0
- aas_core_codegen/protobuf/structure/__init__.py +6 -0
- aas_core_codegen/protobuf/structure/_generate.py +502 -0
- aas_core_codegen/py.typed +1 -0
- aas_core_codegen/python/__init__.py +1 -0
- aas_core_codegen/python/aas_common/__init__.py +4 -0
- aas_core_codegen/python/aas_common/_generate.py +63 -0
- aas_core_codegen/python/common.py +406 -0
- aas_core_codegen/python/constants/__init__.py +5 -0
- aas_core_codegen/python/constants/_generate.py +377 -0
- aas_core_codegen/python/description.py +508 -0
- aas_core_codegen/python/jsonization/__init__.py +4 -0
- aas_core_codegen/python/jsonization/_generate.py +1391 -0
- aas_core_codegen/python/main.py +323 -0
- aas_core_codegen/python/naming.py +255 -0
- aas_core_codegen/python/stringification/__init__.py +4 -0
- aas_core_codegen/python/stringification/_generate.py +129 -0
- aas_core_codegen/python/structure/__init__.py +6 -0
- aas_core_codegen/python/structure/_generate.py +1801 -0
- aas_core_codegen/python/transpilation.py +958 -0
- aas_core_codegen/python/unrolling.py +156 -0
- aas_core_codegen/python/verification/__init__.py +6 -0
- aas_core_codegen/python/verification/_generate.py +1471 -0
- aas_core_codegen/python/xmlization/__init__.py +4 -0
- aas_core_codegen/python/xmlization/_generate.py +3003 -0
- aas_core_codegen/python_protobuf/__init__.py +1 -0
- aas_core_codegen/python_protobuf/main.py +1424 -0
- aas_core_codegen/python_protobuf/naming.py +85 -0
- aas_core_codegen/rdf_shacl/__init__.py +1 -0
- aas_core_codegen/rdf_shacl/_description.py +351 -0
- aas_core_codegen/rdf_shacl/common.py +206 -0
- aas_core_codegen/rdf_shacl/main.py +114 -0
- aas_core_codegen/rdf_shacl/naming.py +145 -0
- aas_core_codegen/rdf_shacl/rdf.py +435 -0
- aas_core_codegen/rdf_shacl/shacl.py +453 -0
- aas_core_codegen/run.py +124 -0
- aas_core_codegen/smoke/__init__.py +1 -0
- aas_core_codegen/smoke/main.py +219 -0
- aas_core_codegen/specific_implementations.py +72 -0
- aas_core_codegen/stringify.py +333 -0
- aas_core_codegen/typescript/__init__.py +1 -0
- aas_core_codegen/typescript/aas_common/__init__.py +4 -0
- aas_core_codegen/typescript/aas_common/_generate.py +472 -0
- aas_core_codegen/typescript/common.py +340 -0
- aas_core_codegen/typescript/constants/__init__.py +5 -0
- aas_core_codegen/typescript/constants/_generate.py +347 -0
- aas_core_codegen/typescript/description.py +530 -0
- aas_core_codegen/typescript/jsonization/__init__.py +4 -0
- aas_core_codegen/typescript/jsonization/_generate.py +1510 -0
- aas_core_codegen/typescript/main.py +258 -0
- aas_core_codegen/typescript/naming.py +189 -0
- aas_core_codegen/typescript/stringification/__init__.py +4 -0
- aas_core_codegen/typescript/stringification/_generate.py +367 -0
- aas_core_codegen/typescript/structure/__init__.py +6 -0
- aas_core_codegen/typescript/structure/_generate.py +2500 -0
- aas_core_codegen/typescript/transpilation.py +1051 -0
- aas_core_codegen/typescript/unrolling.py +159 -0
- aas_core_codegen/typescript/verification/__init__.py +6 -0
- aas_core_codegen/typescript/verification/_generate.py +1578 -0
- aas_core_codegen/xsd/__init__.py +1 -0
- aas_core_codegen/xsd/main.py +1187 -0
- aas_core_codegen/xsd/naming.py +83 -0
- aas_core_codegen/yielding/__init__.py +1 -0
- aas_core_codegen/yielding/flow.py +139 -0
- aas_core_codegen/yielding/linear.py +754 -0
- aas_core_codegen-0.0.16.dist-info/METADATA +211 -0
- aas_core_codegen-0.0.16.dist-info/RECORD +604 -0
- aas_core_codegen-0.0.16.dist-info/WHEEL +5 -0
- aas_core_codegen-0.0.16.dist-info/entry_points.txt +3 -0
- aas_core_codegen-0.0.16.dist-info/licenses/AUTHORS +9 -0
- aas_core_codegen-0.0.16.dist-info/licenses/LICENSE +23 -0
- aas_core_codegen-0.0.16.dist-info/top_level.txt +2 -0
- dev/continuous_integration/__init__.py +1 -0
- dev/continuous_integration/check_help_in_readme.py +208 -0
- dev/continuous_integration/check_init_and_pyproject_consistent.py +154 -0
- dev/continuous_integration/precommit.py +400 -0
- dev/dev_scripts/__init__.py +1 -0
- dev/dev_scripts/compare_rendered_regexes_against_source_py.py +42 -0
- dev/dev_scripts/copy_to_aas_core3_cpp.py +100 -0
- dev/dev_scripts/copy_to_aas_core3_java.py +90 -0
- dev/dev_scripts/download_latest_aas_core_meta_v3.py +114 -0
- dev/dev_scripts/draw_bipartite_graph_based_on_lines.py +37 -0
- dev/dev_scripts/run_tests_with_rerecord.py +69 -0
- dev/dev_scripts/update_to_aas_core_meta.py +174 -0
- dev/integration_tests/input/jsonschema/boilerplate/main.py +55 -0
- dev/integration_tests/input/meta_model.py +38 -0
- dev/integration_tests/input/python/boilerplate/main.py +153 -0
- dev/integration_tests/main.py +258 -0
- dev/test_data/csharp/test_structure/concrete_class_with_descendants/meta_model.py +15 -0
- dev/test_data/csharp/test_structure/constructor_without_arguments/all_properties_optional/meta_model.py +9 -0
- dev/test_data/csharp/test_structure/constructor_without_arguments/no_properties/meta_model.py +6 -0
- dev/test_data/csharp/test_verification/builtin_functions/len/on_list/meta_model.py +20 -0
- dev/test_data/csharp/test_verification/builtin_functions/len/on_str/meta_model.py +16 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/as_prefix/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/as_suffix/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/in_group_with_quantifier/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/in_the_middle/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/in_union/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/single_utf32_literal/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/with_quantifier_within_group/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_as_literal/with_quantifier_without_group/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/at_the_beginning/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/at_the_end/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/in_the_middle/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/multiple/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/single/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/literal/single_with_quantifier/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/mixed_with_non_utf32/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/more_than_two_high_surrogates/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/multiple_utf32_ranges/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/multiple_utf32_ranges_mixed_with_non_utf32/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/same_high_surrogate/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/same_high_surrogate_with_quantifier/meta_model.py +8 -0
- dev/test_data/csharp/test_verification/pattern_verification/utf32_in_character_set/range/two_high_surrogates/meta_model.py +8 -0
- dev/test_data/intermediate/expected/class/empty/meta_model.py +6 -0
- dev/test_data/intermediate/expected/class/implementation_specific_method/meta_model.py +8 -0
- dev/test_data/intermediate/expected/class/inheritance/meta_model.py +41 -0
- dev/test_data/intermediate/expected/class/methods_with_contracts/meta_model.py +15 -0
- dev/test_data/intermediate/expected/class/only_method_no_property/meta_model.py +7 -0
- dev/test_data/intermediate/expected/class/only_property_no_method/meta_model.py +9 -0
- dev/test_data/intermediate/expected/constant/constant_set/of_enum/meta_model.py +12 -0
- dev/test_data/intermediate/expected/constant/constant_set/of_str/meta_model.py +4 -0
- dev/test_data/intermediate/expected/constant/constant_set/with_description/meta_model.py +6 -0
- dev/test_data/intermediate/expected/constant/constant_set/with_superset_of/meta_model.py +14 -0
- dev/test_data/intermediate/expected/constant/constant_str/only_value/meta_model.py +7 -0
- dev/test_data/intermediate/expected/constant/constant_str/with_description/meta_model.py +5 -0
- dev/test_data/intermediate/expected/documentation/docstring_with_special_characters_in_literal/meta_model.py +20 -0
- dev/test_data/intermediate/expected/documentation/docstring_with_special_characters_outside_literal/meta_model.py +20 -0
- dev/test_data/intermediate/expected/empty/meta_model.py +2 -0
- dev/test_data/intermediate/expected/enumeration/meta_model.py +9 -0
- dev/test_data/intermediate/expected/interface/basic/meta_model.py +14 -0
- dev/test_data/intermediate/expected/interface/empty/meta_model.py +7 -0
- dev/test_data/intermediate/expected/interface/inheritance/meta_model.py +27 -0
- dev/test_data/intermediate/expected/interface/method_signature/meta_model.py +10 -0
- dev/test_data/intermediate/expected/interface/only_constructor/meta_model.py +11 -0
- dev/test_data/intermediate/expected/method/non_mutating/implementation_specific/meta_model.py +12 -0
- dev/test_data/intermediate/expected/method/non_mutating/understood/meta_model.py +11 -0
- dev/test_data/intermediate/expected/type_annotation/atomic/meta_model.py +9 -0
- dev/test_data/intermediate/expected/type_annotation/subscripted/class/meta_model.py +13 -0
- dev/test_data/intermediate/expected/type_annotation/subscripted/primitive/meta_model.py +9 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/enumeration_literals_in_subset_outside_of_superset/meta_model.py +20 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/invalid_literal/meta_model.py +11 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/mismatch_between_enumeration_and_literal/meta_model.py +30 -0
- dev/test_data/intermediate/unexpected/constant_set/of_enum/mismatch_in_enumerations_between_subset_and_superset/meta_model.py +21 -0
- dev/test_data/intermediate/unexpected/constant_set/of_str/literals_in_subset_outside_of_superset/meta_model.py +18 -0
- dev/test_data/intermediate/unexpected/constant_set/of_str/mismatch_between_type_annotation_and_literals/meta_model.py +10 -0
- dev/test_data/intermediate/unexpected/constant_set/of_str/superset_and_subset_mismatch_in_type/meta_model.py +12 -0
- dev/test_data/intermediate/unexpected/constraints/dangling_constraintref/meta_model.py +18 -0
- dev/test_data/intermediate/unexpected/constraints/duplicate_constraints/meta_model.py +20 -0
- dev/test_data/intermediate/unexpected/documentation/unexpected_documentation_elements/meta_model.py +34 -0
- dev/test_data/intermediate/unexpected/invariant/class_invariant_uses_re/meta_model.py +10 -0
- dev/test_data/intermediate/unexpected/invariant/invariant_of_constrained_primitive_uses_re/meta_model.py +7 -0
- dev/test_data/intermediate/unexpected/invariant/unexpected_argument_count_to_len/meta_model.py +20 -0
- dev/test_data/intermediate/unexpected/invariant/unhandled_built_in_function/meta_model.py +16 -0
- dev/test_data/intermediate/unexpected/method_definitions/non_constant_default/meta_model.py +7 -0
- dev/test_data/intermediate/unexpected/optional_constructor_arguments_wo_default/default_non_none/meta_model.py +16 -0
- dev/test_data/intermediate/unexpected/optional_constructor_arguments_wo_default/no_default/meta_model.py +16 -0
- dev/test_data/intermediate/unexpected/properties_and_constructor_arguments_do_not_match/after_inheritance/meta_model.py +58 -0
- dev/test_data/intermediate/unexpected/properties_and_constructor_arguments_do_not_match/type_missmatch/meta_model.py +9 -0
- dev/test_data/intermediate/unexpected/properties_and_constructor_arguments_do_not_match/within_class/meta_model.py +22 -0
- dev/test_data/jsonschema/test_main/regression_when_len_constraints_on_inherited_property/meta_model.py +28 -0
- dev/test_data/opcua/test_main/abstract_and_concrete_classes/meta_model.py +37 -0
- dev/test_data/opcua/test_main/classes_with_invariants/meta_model.py +21 -0
- dev/test_data/opcua/test_main/concrete_class_with_descendant/meta_model.py +27 -0
- dev/test_data/opcua/test_main/concrete_class_with_enum/meta_model.py +21 -0
- dev/test_data/opcua/test_main/concrete_class_with_list_of_instances/meta_model.py +21 -0
- dev/test_data/opcua/test_main/concrete_class_with_primitive_attributes/meta_model.py +41 -0
- dev/test_data/opcua/test_main/concrete_class_with_string/meta_model.py +13 -0
- dev/test_data/opcua/test_main/constrained_primitive/meta_model.py +20 -0
- dev/test_data/opcua/test_main/multiple_inheritance/meta_model.py +25 -0
- dev/test_data/parse/expected/constant/constant_set/of_enum/meta_model.py +12 -0
- dev/test_data/parse/expected/constant/constant_set/of_str/meta_model.py +4 -0
- dev/test_data/parse/expected/constant/constant_set/with_description/meta_model.py +6 -0
- dev/test_data/parse/expected/constant/constant_set/with_superset_of/meta_model.py +14 -0
- dev/test_data/parse/expected/constant/constant_str/only_value/meta_model.py +7 -0
- dev/test_data/parse/expected/constant/constant_str/with_description/meta_model.py +5 -0
- dev/test_data/parse/expected/enum/ok/meta_model.py +15 -0
- dev/test_data/parse/expected/implementation_specific_class/properties_and_methods_in_implementation_specific_class/meta_model.py +17 -0
- dev/test_data/parse/expected/inheritance/basic/meta_model.py +11 -0
- dev/test_data/parse/expected/inheritance/diamond/meta_model.py +26 -0
- dev/test_data/parse/expected/inheritance/inheritance_from_concrete_class/meta_model.py +10 -0
- dev/test_data/parse/expected/invariants/in_relation/meta_model.py +16 -0
- dev/test_data/parse/expected/method/arguments/meta_model.py +7 -0
- dev/test_data/parse/expected/method/basic/meta_model.py +7 -0
- dev/test_data/parse/expected/method/contracts/condition_as_keyword_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/condition_as_positional_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/description_as_keyword_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/description_as_positional_argument/meta_model.py +8 -0
- dev/test_data/parse/expected/method/contracts/multiple_contracts_in_order/meta_model.py +17 -0
- dev/test_data/parse/expected/method/contracts/postcondition/basic/meta_model.py +10 -0
- dev/test_data/parse/expected/method/contracts/postcondition/snapshot/with_keyword_arguments/meta_model.py +9 -0
- dev/test_data/parse/expected/method/contracts/postcondition/snapshot/with_positional_arguments/meta_model.py +9 -0
- dev/test_data/parse/expected/method/default/meta_model.py +9 -0
- dev/test_data/parse/expected/method/description/meta_model.py +8 -0
- dev/test_data/parse/expected/method/is_implementation_specific/meta_model.py +8 -0
- dev/test_data/parse/expected/method/non_mutating/meta_model.py +11 -0
- dev/test_data/parse/expected/method/returns_none/meta_model.py +7 -0
- dev/test_data/parse/expected/method/returns_something/meta_model.py +7 -0
- dev/test_data/parse/expected/single_class/description/meta_model.py +12 -0
- dev/test_data/parse/expected/single_class/empty/meta_model.py +6 -0
- dev/test_data/parse/expected/single_class/property/description/meta_model.py +14 -0
- dev/test_data/parse/expected/single_class/property/mandatory/meta_model.py +6 -0
- dev/test_data/parse/expected/single_class/property/optional/meta_model.py +6 -0
- dev/test_data/parse/expected/single_class/property/recursion_to_entity/meta_model.py +6 -0
- dev/test_data/parse/unexpected/class_decorators/non_name_decorator/meta_model.py +7 -0
- dev/test_data/parse/unexpected/class_decorators/unknown_decorator/meta_model.py +7 -0
- dev/test_data/parse/unexpected/class_definitions/is_abstract_and_implementation_specific/meta_model.py +8 -0
- dev/test_data/parse/unexpected/class_definitions/unexpected_docstring_before_a_method/meta_model.py +11 -0
- dev/test_data/parse/unexpected/class_definitions/unexpected_docstring_for_a_pass/meta_model.py +9 -0
- dev/test_data/parse/unexpected/class_definitions/unexpected_double_description_for_a_property/meta_model.py +10 -0
- dev/test_data/parse/unexpected/class_inheritances/inheriting_from_implementation_specific_parent/meta_model.py +20 -0
- dev/test_data/parse/unexpected/class_inheritances/non_name_super_class/meta_model.py +6 -0
- dev/test_data/parse/unexpected/enum/expression_as_assignment_value/meta_model.py +6 -0
- dev/test_data/parse/unexpected/enum/non_assignment/meta_model.py +8 -0
- dev/test_data/parse/unexpected/enum/non_string_literal/meta_model.py +6 -0
- dev/test_data/parse/unexpected/enum/unexpected_inheritance/meta_model.py +6 -0
- dev/test_data/parse/unexpected/method_contracts/contract/non_lambda_condition/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/contract/non_string_literal_description/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/contract/without_any_arguments/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/contract/without_condition/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/postcondition/OLD_in_postcondition_without_snapshot/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/postcondition/argument_missing_in_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/precondition/argument_missing_in_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/argument_missing_in_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/capture_not_a_lambda/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/invalid_name/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/name_not_a_string_literal/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/without_a_capture/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_contracts/snapshot/without_a_name/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/non_mutating/non_mutating_constructor/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/non_mutating/non_mutating_verification_function/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/non_name_decorator/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/unknown_call_decorator/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_decorators/unknown_name_decorator/meta_model.py +8 -0
- dev/test_data/parse/unexpected/method_definitions/argument_with_final/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/argument_without_a_type_annotation/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/default_for_self/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/dunder/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/init_with_return_type/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_keyword_only_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_positional_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_type_annotation_for_self/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_variable_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/with_variable_keyword_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/without_arguments/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/without_self/meta_model.py +7 -0
- dev/test_data/parse/unexpected/method_definitions/without_type_annotation_for_result/meta_model.py +7 -0
- dev/test_data/parse/unexpected/property_definitions/final_without_subscript/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/nested_final/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/non_simple/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/unexpected_assignment/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/unexpected_non_name_property/meta_model.py +6 -0
- dev/test_data/parse/unexpected/property_definitions/without_type_annotation/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/constant_set_with_a_non_set_subset/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_inheritance/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_reference_in_type_annotation_of_a_property/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_reference_in_type_annotation_of_an_argument/meta_model.py +7 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_reference_in_type_annotation_of_constant_set/meta_model.py +6 -0
- dev/test_data/parse/unexpected/symbol_table/dangling_subset_in_constant_set/meta_model.py +4 -0
- dev/test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py +10 -0
- dev/test_data/parse_retree/expected/character_set/common_escaping/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/complementing/double_caret/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/complementing/multiple_ranges/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/complementing/suffix_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/escape_first_caret/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/literals_which_need_no_escaping_in_characters_set_but_need_escaping_outside/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/multiple_ranges/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/single_literal/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/single_range/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/unescaped_dash/only_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/unescaped_dash/prefix_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/character_set/unescaped_dash/suffix_dash/source.py +1 -0
- dev/test_data/parse_retree/expected/dot/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/group/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/group_in_a_group/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/group_of_union_of_empty_concatenations/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/regex/source.py +1 -0
- dev/test_data/parse_retree/expected/empty/union_of_empty_concatenations/source.py +1 -0
- dev/test_data/parse_retree/expected/escaped_literals/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/at_the_beginning/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/at_the_end/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/in_the_middle/source.py +1 -0
- dev/test_data/parse_retree/expected/formatted_value/single_formatted_value/source.py +1 -0
- dev/test_data/parse_retree/expected/literal/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/at_least_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/at_least_one/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/at_most_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/exactly_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/maybe/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/greedy/zero_or_more/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/at_least_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/at_least_one/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/at_most_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/exactly_3/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/maybe/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/non_greedy/zero_or_more/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_character_set/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_formatted_value/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_group/source.py +1 -0
- dev/test_data/parse_retree/expected/quantifier/on_a_literal/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/double_end_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/double_start_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/end_symbol_in_the_middle/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/only_start_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/only_stop_symbol/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/start_symbol_at_the_beginning/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/start_symbol_in_the_middle/source.py +1 -0
- dev/test_data/parse_retree/expected/start_and_stop_symbols/stop_symbol_at_the_end/source.py +1 -0
- dev/test_data/parse_retree/expected/union/of_character_sets/source.py +1 -0
- dev/test_data/parse_retree/expected/union/of_groups/source.py +1 -0
- dev/test_data/parse_retree/expected/union/of_string_literals/source.py +1 -0
- dev/test_data/parse_retree/expected/union/within_group/source.py +1 -0
- dev/test_data/parse_retree/expected/whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/Uxxxxxxxx_out_of_range/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/only_backslash/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/short_Uxxxxxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/short_uxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/short_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unexpected_escaping/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/not_digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/not_whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/not_word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/character_literal/unhandled/word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/Uxxxxxxxx_out_of_range/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/only_backslash/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/short_Uxxxxxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/short_uxxxx/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/short_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unexpected_escaping/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/not_digit/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/not_whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/not_word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/whitespace/source.py +1 -0
- dev/test_data/parse_retree/unexpected/improper_escaping/range_character/unhandled/word/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_character_range/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_quantifier/at_least_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_quantifier/between_3_and_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/invalid_quantifier/exactly_x/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unhandled_group_directives/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/character_set/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/group/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/group_of_union_of_empty_concatenations/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/quantifier/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/quantifier_with_comma/source.py +1 -0
- dev/test_data/parse_retree/unexpected/unterminated/quantifier_with_number_and_comma/source.py +1 -0
- dev/test_data/proto/test_main/expected/abstract_and_concrete_classes/meta_model.py +37 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_descendants/meta_model.py +30 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_enum/meta_model.py +21 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_list_of_instances/meta_model.py +21 -0
- dev/test_data/proto/test_main/expected/concrete_class_with_primitive_attributes/meta_model.py +41 -0
- dev/test_data/python_protobuf/test_main/abstract_and_concrete_classes/expected_output/pbization.py +532 -0
- dev/test_data/python_protobuf/test_main/abstract_and_concrete_classes/meta_model.py +37 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_descendant/expected_output/pbization.py +527 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_descendant/meta_model.py +27 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_enum/expected_output/pbization.py +290 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_enum/meta_model.py +21 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_list_of_instances/expected_output/pbization.py +328 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_list_of_instances/meta_model.py +23 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_primitive_attributes/expected_output/pbization.py +274 -0
- dev/test_data/python_protobuf/test_main/concrete_class_with_primitive_attributes/meta_model.py +41 -0
- dev/test_data/rdf_shacl/test_main/expected/regression_when_lang_string_class_is_missing/meta_model.py +29 -0
- dev/test_data/rdf_shacl/test_main/expected/regression_when_len_constraints_on_inherited_property/meta_model.py +27 -0
- dev/test_data/rdf_shacl/test_main/unexpected/regression_len_constraint_on_class_property/meta_model.py +61 -0
- dev/test_data/real_meta_models/aas_core_meta.v3.py +5721 -0
- dev/test_data/smoke/test_main/unexpected/infer_for_schema_error/meta_model.py +12 -0
- dev/test_data/smoke/test_main/unexpected/intermediate_error/meta_model.py +18 -0
- dev/test_data/smoke/test_main/unexpected/parse_error/meta_model.py +5 -0
- dev/test_data/smoke/test_main/unexpected/pattern_verification_unparsable_regex/direct_match/meta_model.py +8 -0
- dev/test_data/smoke/test_main/unexpected/type_error/meta_model.py +18 -0
- dev/tests/__init__.py +1 -0
- dev/tests/common.py +197 -0
- dev/tests/cpp/__init__.py +0 -0
- dev/tests/cpp/test_common.py +32 -0
- dev/tests/cpp/test_main.py +144 -0
- dev/tests/cpp/test_pattern.py +188 -0
- dev/tests/cpp/test_verification.py +189 -0
- dev/tests/cpp/test_yielding.py +225 -0
- dev/tests/csharp/__init__.py +0 -0
- dev/tests/csharp/live_test_main.py +109 -0
- dev/tests/csharp/test_common.py +28 -0
- dev/tests/csharp/test_description.py +684 -0
- dev/tests/csharp/test_main.py +129 -0
- dev/tests/csharp/test_structure.py +93 -0
- dev/tests/csharp/test_verification.py +82 -0
- dev/tests/description.py +29 -0
- dev/tests/golang/__init__.py +0 -0
- dev/tests/golang/test_common.py +78 -0
- dev/tests/golang/test_main.py +128 -0
- dev/tests/infer_for_schema/__init__.py +0 -0
- dev/tests/infer_for_schema/common.py +47 -0
- dev/tests/infer_for_schema/test_len_on_properties.py +955 -0
- dev/tests/infer_for_schema/test_len_on_self.py +580 -0
- dev/tests/infer_for_schema/test_patterns_on_properties.py +686 -0
- dev/tests/infer_for_schema/test_patterns_on_self.py +258 -0
- dev/tests/infer_for_schema/test_property_in_set_of_enumeration_literals.py +600 -0
- dev/tests/infer_for_schema/test_property_in_set_of_primitives.py +549 -0
- dev/tests/intermediate/__init__.py +0 -0
- dev/tests/intermediate/test_constructor.py +719 -0
- dev/tests/intermediate/test_hierarchy.py +221 -0
- dev/tests/intermediate/test_revm.py +134 -0
- dev/tests/intermediate/test_translate.py +337 -0
- dev/tests/intermediate/test_type_inference.py +333 -0
- dev/tests/intermediate/test_types.py +169 -0
- dev/tests/java/__init__.py +0 -0
- dev/tests/java/test_common.py +20 -0
- dev/tests/java/test_description.py +128 -0
- dev/tests/java/test_main.py +234 -0
- dev/tests/jsonld_context/test_main.py +79 -0
- dev/tests/opcua/__init__.py +3 -0
- dev/tests/opcua/test_main.py +110 -0
- dev/tests/our_jsonschema/__init__.py +3 -0
- dev/tests/our_jsonschema/test_main.py +232 -0
- dev/tests/parse/__init__.py +0 -0
- dev/tests/parse/test_parse.py +503 -0
- dev/tests/parse/test_retree.py +272 -0
- dev/tests/proto/__init__.py +0 -0
- dev/tests/proto/test_main.py +112 -0
- dev/tests/python/__init__.py +0 -0
- dev/tests/python/test_common.py +124 -0
- dev/tests/python/test_main.py +126 -0
- dev/tests/python/test_xml_playground.py +254 -0
- dev/tests/python_protobuf/__init__.py +0 -0
- dev/tests/python_protobuf/test_main.py +111 -0
- dev/tests/rdf_shacl/__init__.py +0 -0
- dev/tests/rdf_shacl/test_common.py +32 -0
- dev/tests/rdf_shacl/test_description.py +223 -0
- dev/tests/rdf_shacl/test_main.py +194 -0
- dev/tests/smoke/__init__.py +0 -0
- dev/tests/smoke/test_main.py +83 -0
- dev/tests/test_common.py +94 -0
- dev/tests/typescript/__init__.py +0 -0
- dev/tests/typescript/test_common.py +108 -0
- dev/tests/typescript/test_main.py +125 -0
- dev/tests/xsd/__init__.py +0 -0
- dev/tests/xsd/test_main.py +227 -0
- dev/tests/yielding/__init__.py +0 -0
- dev/tests/yielding/test_linear.py +558 -0
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
# pylint: disable=missing-docstring
|
|
2
|
+
|
|
3
|
+
import textwrap
|
|
4
|
+
import unittest
|
|
5
|
+
from typing import Optional, MutableMapping
|
|
6
|
+
|
|
7
|
+
import tests.common
|
|
8
|
+
import tests.infer_for_schema.common
|
|
9
|
+
from aas_core_codegen import infer_for_schema, intermediate
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Test_expected(unittest.TestCase):
|
|
13
|
+
def test_no_constraints(self) -> None:
|
|
14
|
+
source = textwrap.dedent(
|
|
15
|
+
"""\
|
|
16
|
+
class Something:
|
|
17
|
+
some_property: str
|
|
18
|
+
|
|
19
|
+
def __init__(self, some_property: str) -> None:
|
|
20
|
+
self.some_property = some_property
|
|
21
|
+
|
|
22
|
+
__version__ = "dummy"
|
|
23
|
+
__xml_namespace__ = "https://dummy.com"
|
|
24
|
+
"""
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# fmt: off
|
|
28
|
+
(
|
|
29
|
+
_,
|
|
30
|
+
something_cls,
|
|
31
|
+
constraints_by_class,
|
|
32
|
+
) = (
|
|
33
|
+
tests.infer_for_schema.common
|
|
34
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
35
|
+
source=source
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
# fmt: on
|
|
39
|
+
|
|
40
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
41
|
+
|
|
42
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
43
|
+
self.assertEqual(
|
|
44
|
+
textwrap.dedent(
|
|
45
|
+
"""\
|
|
46
|
+
ConstraintsByProperty(
|
|
47
|
+
len_constraints_by_property={},
|
|
48
|
+
patterns_by_property={},
|
|
49
|
+
set_of_primitives_by_property={},
|
|
50
|
+
set_of_enumeration_literals_by_property={})"""
|
|
51
|
+
),
|
|
52
|
+
text,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def test_min_value_constant_left(self) -> None:
|
|
56
|
+
source = textwrap.dedent(
|
|
57
|
+
"""\
|
|
58
|
+
@invariant(
|
|
59
|
+
lambda self: 10 < len(self.some_property),
|
|
60
|
+
"Some property must be more than 10 characters long."
|
|
61
|
+
)
|
|
62
|
+
class Something:
|
|
63
|
+
some_property: str
|
|
64
|
+
|
|
65
|
+
def __init__(self, some_property: str) -> None:
|
|
66
|
+
self.some_property = some_property
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
__version__ = "dummy"
|
|
70
|
+
__xml_namespace__ = "https://dummy.com"
|
|
71
|
+
"""
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# fmt: off
|
|
75
|
+
(
|
|
76
|
+
_,
|
|
77
|
+
something_cls,
|
|
78
|
+
constraints_by_class,
|
|
79
|
+
) = (
|
|
80
|
+
tests.infer_for_schema.common
|
|
81
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
82
|
+
source=source
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
# fmt: on
|
|
86
|
+
|
|
87
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
88
|
+
|
|
89
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
90
|
+
self.assertEqual(
|
|
91
|
+
textwrap.dedent(
|
|
92
|
+
"""\
|
|
93
|
+
ConstraintsByProperty(
|
|
94
|
+
len_constraints_by_property={
|
|
95
|
+
'some_property': LenConstraint(
|
|
96
|
+
min_value=11,
|
|
97
|
+
max_value=None)},
|
|
98
|
+
patterns_by_property={},
|
|
99
|
+
set_of_primitives_by_property={},
|
|
100
|
+
set_of_enumeration_literals_by_property={})"""
|
|
101
|
+
),
|
|
102
|
+
text,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def test_min_value_constant_right(self) -> None:
|
|
106
|
+
source = textwrap.dedent(
|
|
107
|
+
"""\
|
|
108
|
+
@invariant(
|
|
109
|
+
lambda self: len(self.some_property) > 10,
|
|
110
|
+
"Some property must be more than 10 characters long."
|
|
111
|
+
)
|
|
112
|
+
class Something:
|
|
113
|
+
some_property: str
|
|
114
|
+
|
|
115
|
+
def __init__(self, some_property: str) -> None:
|
|
116
|
+
self.some_property = some_property
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
__version__ = "dummy"
|
|
120
|
+
__xml_namespace__ = "https://dummy.com"
|
|
121
|
+
"""
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
# fmt: off
|
|
125
|
+
(
|
|
126
|
+
_,
|
|
127
|
+
something_cls,
|
|
128
|
+
constraints_by_class,
|
|
129
|
+
) = (
|
|
130
|
+
tests.infer_for_schema.common
|
|
131
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
132
|
+
source=source
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
# fmt: on
|
|
136
|
+
|
|
137
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
138
|
+
|
|
139
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
140
|
+
self.assertEqual(
|
|
141
|
+
textwrap.dedent(
|
|
142
|
+
"""\
|
|
143
|
+
ConstraintsByProperty(
|
|
144
|
+
len_constraints_by_property={
|
|
145
|
+
'some_property': LenConstraint(
|
|
146
|
+
min_value=11,
|
|
147
|
+
max_value=None)},
|
|
148
|
+
patterns_by_property={},
|
|
149
|
+
set_of_primitives_by_property={},
|
|
150
|
+
set_of_enumeration_literals_by_property={})"""
|
|
151
|
+
),
|
|
152
|
+
text,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
def test_max_value_constant_right(self) -> None:
|
|
156
|
+
source = textwrap.dedent(
|
|
157
|
+
"""\
|
|
158
|
+
@invariant(
|
|
159
|
+
lambda self: len(self.some_property) < 10,
|
|
160
|
+
"Some property must be less than 10 characters long."
|
|
161
|
+
)
|
|
162
|
+
class Something:
|
|
163
|
+
some_property: str
|
|
164
|
+
|
|
165
|
+
def __init__(self, some_property: str) -> None:
|
|
166
|
+
self.some_property = some_property
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
__version__ = "dummy"
|
|
170
|
+
__xml_namespace__ = "https://dummy.com"
|
|
171
|
+
"""
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# fmt: off
|
|
175
|
+
(
|
|
176
|
+
_,
|
|
177
|
+
something_cls,
|
|
178
|
+
constraints_by_class,
|
|
179
|
+
) = (
|
|
180
|
+
tests.infer_for_schema.common
|
|
181
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
182
|
+
source=source
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
# fmt: on
|
|
186
|
+
|
|
187
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
188
|
+
|
|
189
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
190
|
+
self.assertEqual(
|
|
191
|
+
textwrap.dedent(
|
|
192
|
+
"""\
|
|
193
|
+
ConstraintsByProperty(
|
|
194
|
+
len_constraints_by_property={
|
|
195
|
+
'some_property': LenConstraint(
|
|
196
|
+
min_value=None,
|
|
197
|
+
max_value=9)},
|
|
198
|
+
patterns_by_property={},
|
|
199
|
+
set_of_primitives_by_property={},
|
|
200
|
+
set_of_enumeration_literals_by_property={})"""
|
|
201
|
+
),
|
|
202
|
+
text,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
def test_max_value_constant_left(self) -> None:
|
|
206
|
+
source = textwrap.dedent(
|
|
207
|
+
"""\
|
|
208
|
+
@invariant(
|
|
209
|
+
lambda self: 10 > len(self.some_property),
|
|
210
|
+
"Some property must be less than 10 characters long."
|
|
211
|
+
)
|
|
212
|
+
class Something:
|
|
213
|
+
some_property: str
|
|
214
|
+
|
|
215
|
+
def __init__(self, some_property: str) -> None:
|
|
216
|
+
self.some_property = some_property
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
__version__ = "dummy"
|
|
220
|
+
__xml_namespace__ = "https://dummy.com"
|
|
221
|
+
"""
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
# fmt: off
|
|
225
|
+
(
|
|
226
|
+
_,
|
|
227
|
+
something_cls,
|
|
228
|
+
constraints_by_class,
|
|
229
|
+
) = (
|
|
230
|
+
tests.infer_for_schema.common
|
|
231
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
232
|
+
source=source
|
|
233
|
+
)
|
|
234
|
+
)
|
|
235
|
+
# fmt: on
|
|
236
|
+
|
|
237
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
238
|
+
|
|
239
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
240
|
+
self.assertEqual(
|
|
241
|
+
textwrap.dedent(
|
|
242
|
+
"""\
|
|
243
|
+
ConstraintsByProperty(
|
|
244
|
+
len_constraints_by_property={
|
|
245
|
+
'some_property': LenConstraint(
|
|
246
|
+
min_value=None,
|
|
247
|
+
max_value=9)},
|
|
248
|
+
patterns_by_property={},
|
|
249
|
+
set_of_primitives_by_property={},
|
|
250
|
+
set_of_enumeration_literals_by_property={})"""
|
|
251
|
+
),
|
|
252
|
+
text,
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
def test_max_value_constant_right_and_not_required(self) -> None:
|
|
256
|
+
source = textwrap.dedent(
|
|
257
|
+
"""\
|
|
258
|
+
@invariant(
|
|
259
|
+
lambda self:
|
|
260
|
+
not (self.some_property is not None)
|
|
261
|
+
or len(self.some_property) <= 128,
|
|
262
|
+
"Some property must be at most 128 characters long."
|
|
263
|
+
)
|
|
264
|
+
class Something:
|
|
265
|
+
some_property: str
|
|
266
|
+
|
|
267
|
+
def __init__(self, some_property: str) -> None:
|
|
268
|
+
self.some_property = some_property
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
__version__ = "dummy"
|
|
272
|
+
__xml_namespace__ = "https://dummy.com"
|
|
273
|
+
"""
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
# fmt: off
|
|
277
|
+
(
|
|
278
|
+
_,
|
|
279
|
+
something_cls,
|
|
280
|
+
constraints_by_class,
|
|
281
|
+
) = (
|
|
282
|
+
tests.infer_for_schema.common
|
|
283
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
284
|
+
source=source
|
|
285
|
+
)
|
|
286
|
+
)
|
|
287
|
+
# fmt: on
|
|
288
|
+
|
|
289
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
290
|
+
|
|
291
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
292
|
+
self.assertEqual(
|
|
293
|
+
textwrap.dedent(
|
|
294
|
+
"""\
|
|
295
|
+
ConstraintsByProperty(
|
|
296
|
+
len_constraints_by_property={
|
|
297
|
+
'some_property': LenConstraint(
|
|
298
|
+
min_value=None,
|
|
299
|
+
max_value=128)},
|
|
300
|
+
patterns_by_property={},
|
|
301
|
+
set_of_primitives_by_property={},
|
|
302
|
+
set_of_enumeration_literals_by_property={})"""
|
|
303
|
+
),
|
|
304
|
+
text,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
def test_exact_value_constant_left(self) -> None:
|
|
308
|
+
source = textwrap.dedent(
|
|
309
|
+
"""\
|
|
310
|
+
@invariant(
|
|
311
|
+
lambda self: 10 == len(self.some_property),
|
|
312
|
+
"Some property must be exactly 10 characters long."
|
|
313
|
+
)
|
|
314
|
+
class Something:
|
|
315
|
+
some_property: str
|
|
316
|
+
|
|
317
|
+
def __init__(self, some_property: str) -> None:
|
|
318
|
+
self.some_property = some_property
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
__version__ = "dummy"
|
|
322
|
+
__xml_namespace__ = "https://dummy.com"
|
|
323
|
+
"""
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
# fmt: off
|
|
327
|
+
(
|
|
328
|
+
_,
|
|
329
|
+
something_cls,
|
|
330
|
+
constraints_by_class,
|
|
331
|
+
) = (
|
|
332
|
+
tests.infer_for_schema.common
|
|
333
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
334
|
+
source=source
|
|
335
|
+
)
|
|
336
|
+
)
|
|
337
|
+
# fmt: on
|
|
338
|
+
|
|
339
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
340
|
+
|
|
341
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
342
|
+
self.assertEqual(
|
|
343
|
+
textwrap.dedent(
|
|
344
|
+
"""\
|
|
345
|
+
ConstraintsByProperty(
|
|
346
|
+
len_constraints_by_property={
|
|
347
|
+
'some_property': LenConstraint(
|
|
348
|
+
min_value=10,
|
|
349
|
+
max_value=10)},
|
|
350
|
+
patterns_by_property={},
|
|
351
|
+
set_of_primitives_by_property={},
|
|
352
|
+
set_of_enumeration_literals_by_property={})"""
|
|
353
|
+
),
|
|
354
|
+
text,
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
def test_exact_value_constant_right(self) -> None:
|
|
358
|
+
source = textwrap.dedent(
|
|
359
|
+
"""\
|
|
360
|
+
@invariant(
|
|
361
|
+
lambda self: len(self.some_property) == 10,
|
|
362
|
+
"Some property must be exactly 10 characters long."
|
|
363
|
+
)
|
|
364
|
+
class Something:
|
|
365
|
+
some_property: str
|
|
366
|
+
|
|
367
|
+
def __init__(self, some_property: str) -> None:
|
|
368
|
+
self.some_property = some_property
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
__version__ = "dummy"
|
|
372
|
+
__xml_namespace__ = "https://dummy.com"
|
|
373
|
+
"""
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
# fmt: off
|
|
377
|
+
(
|
|
378
|
+
_,
|
|
379
|
+
something_cls,
|
|
380
|
+
constraints_by_class,
|
|
381
|
+
) = (
|
|
382
|
+
tests.infer_for_schema.common
|
|
383
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
384
|
+
source=source
|
|
385
|
+
)
|
|
386
|
+
)
|
|
387
|
+
# fmt: on
|
|
388
|
+
|
|
389
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
390
|
+
|
|
391
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
392
|
+
self.assertEqual(
|
|
393
|
+
textwrap.dedent(
|
|
394
|
+
"""\
|
|
395
|
+
ConstraintsByProperty(
|
|
396
|
+
len_constraints_by_property={
|
|
397
|
+
'some_property': LenConstraint(
|
|
398
|
+
min_value=10,
|
|
399
|
+
max_value=10)},
|
|
400
|
+
patterns_by_property={},
|
|
401
|
+
set_of_primitives_by_property={},
|
|
402
|
+
set_of_enumeration_literals_by_property={})"""
|
|
403
|
+
),
|
|
404
|
+
text,
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
def test_conditioned_on_property(self) -> None:
|
|
408
|
+
source = textwrap.dedent(
|
|
409
|
+
"""\
|
|
410
|
+
@invariant(
|
|
411
|
+
lambda self:
|
|
412
|
+
not (self.some_property is not None)
|
|
413
|
+
or len(self.some_property) == 10,
|
|
414
|
+
"Some property must be exactly 10 characters long."
|
|
415
|
+
)
|
|
416
|
+
class Something:
|
|
417
|
+
some_property: Optional[str]
|
|
418
|
+
|
|
419
|
+
def __init__(self, some_property: Optional[str] = None) -> None:
|
|
420
|
+
self.some_property = some_property
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
__version__ = "dummy"
|
|
424
|
+
__xml_namespace__ = "https://dummy.com"
|
|
425
|
+
"""
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
# fmt: off
|
|
429
|
+
(
|
|
430
|
+
_,
|
|
431
|
+
something_cls,
|
|
432
|
+
constraints_by_class,
|
|
433
|
+
) = (
|
|
434
|
+
tests.infer_for_schema.common
|
|
435
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
436
|
+
source=source
|
|
437
|
+
)
|
|
438
|
+
)
|
|
439
|
+
# fmt: on
|
|
440
|
+
|
|
441
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
442
|
+
|
|
443
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
444
|
+
self.assertEqual(
|
|
445
|
+
textwrap.dedent(
|
|
446
|
+
"""\
|
|
447
|
+
ConstraintsByProperty(
|
|
448
|
+
len_constraints_by_property={
|
|
449
|
+
'some_property': LenConstraint(
|
|
450
|
+
min_value=10,
|
|
451
|
+
max_value=10)},
|
|
452
|
+
patterns_by_property={},
|
|
453
|
+
set_of_primitives_by_property={},
|
|
454
|
+
set_of_enumeration_literals_by_property={})"""
|
|
455
|
+
),
|
|
456
|
+
text,
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
def test_no_inheritance_by_default(self) -> None:
|
|
460
|
+
source = textwrap.dedent(
|
|
461
|
+
"""\
|
|
462
|
+
@invariant(
|
|
463
|
+
lambda self: len(self.some_property) > 3,
|
|
464
|
+
"Some property must be more than 3 characters long."
|
|
465
|
+
)
|
|
466
|
+
class Parent:
|
|
467
|
+
some_property: str
|
|
468
|
+
|
|
469
|
+
def __init__(self, some_property: str) -> None:
|
|
470
|
+
self.some_property = some_property
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
@invariant(
|
|
474
|
+
lambda self: len(self.some_property) > 5,
|
|
475
|
+
"Some property must be more than 5 characters long."
|
|
476
|
+
)
|
|
477
|
+
class Something(Parent):
|
|
478
|
+
def __init__(self, some_property: str) -> None:
|
|
479
|
+
Parent.__init__(
|
|
480
|
+
self,
|
|
481
|
+
some_property=some_property
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
__version__ = "dummy"
|
|
486
|
+
__xml_namespace__ = "https://dummy.com"
|
|
487
|
+
"""
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
# NOTE (mristin, 2022-01-02):
|
|
491
|
+
# We infer only the constraints as specified in the class itself, and
|
|
492
|
+
# ignore the constraints of the ancestors in *this particular kind of
|
|
493
|
+
# inference*.
|
|
494
|
+
#
|
|
495
|
+
# This is necessary as we want to use these constraints to generate schemas
|
|
496
|
+
# whereas it is the job of the schema engine to stack the constraints together.
|
|
497
|
+
|
|
498
|
+
# fmt: off
|
|
499
|
+
(
|
|
500
|
+
_,
|
|
501
|
+
something_cls,
|
|
502
|
+
constraints_by_class,
|
|
503
|
+
) = (
|
|
504
|
+
tests.infer_for_schema.common
|
|
505
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
506
|
+
source=source
|
|
507
|
+
)
|
|
508
|
+
)
|
|
509
|
+
# fmt: on
|
|
510
|
+
|
|
511
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
512
|
+
|
|
513
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
514
|
+
self.assertEqual(
|
|
515
|
+
textwrap.dedent(
|
|
516
|
+
"""\
|
|
517
|
+
ConstraintsByProperty(
|
|
518
|
+
len_constraints_by_property={
|
|
519
|
+
'some_property': LenConstraint(
|
|
520
|
+
min_value=6,
|
|
521
|
+
max_value=None)},
|
|
522
|
+
patterns_by_property={},
|
|
523
|
+
set_of_primitives_by_property={},
|
|
524
|
+
set_of_enumeration_literals_by_property={})"""
|
|
525
|
+
),
|
|
526
|
+
text,
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
class Test_unexpected(unittest.TestCase):
|
|
531
|
+
def test_conflicting_min_and_max(self) -> None:
|
|
532
|
+
source = textwrap.dedent(
|
|
533
|
+
"""\
|
|
534
|
+
@invariant(
|
|
535
|
+
lambda self: len(self.some_property) > 10,
|
|
536
|
+
"Some property must be more than 10 characters long."
|
|
537
|
+
)
|
|
538
|
+
@invariant(
|
|
539
|
+
lambda self: len(self.some_property) < 3,
|
|
540
|
+
"Some property must be less than 3 characters long."
|
|
541
|
+
)
|
|
542
|
+
class Something:
|
|
543
|
+
some_property: str
|
|
544
|
+
|
|
545
|
+
def __init__(self, some_property: str) -> None:
|
|
546
|
+
self.some_property = some_property
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
__version__ = "dummy"
|
|
550
|
+
__xml_namespace__ = "https://dummy.com"
|
|
551
|
+
"""
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
(
|
|
555
|
+
symbol_table,
|
|
556
|
+
_,
|
|
557
|
+
) = tests.infer_for_schema.common.parse_to_symbol_table_and_something_cls(
|
|
558
|
+
source=source
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
_, error = infer_for_schema.infer_constraints_by_class(
|
|
562
|
+
symbol_table=symbol_table
|
|
563
|
+
)
|
|
564
|
+
|
|
565
|
+
assert error is not None
|
|
566
|
+
self.assertEqual(
|
|
567
|
+
"The property some_property has conflicting invariants on the length: "
|
|
568
|
+
"the minimum length, 11, contradicts the maximum length 2.",
|
|
569
|
+
tests.common.most_underlying_messages(error),
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
def test_conflicting_min_and_exact(self) -> None:
|
|
573
|
+
source = textwrap.dedent(
|
|
574
|
+
"""\
|
|
575
|
+
@invariant(
|
|
576
|
+
lambda self: len(self.some_property) > 10,
|
|
577
|
+
"Some property must be more than 10 characters long."
|
|
578
|
+
)
|
|
579
|
+
@invariant(
|
|
580
|
+
lambda self: len(self.some_property) == 3,
|
|
581
|
+
"Some property must be exactly 3 characters long."
|
|
582
|
+
)
|
|
583
|
+
class Something:
|
|
584
|
+
some_property: str
|
|
585
|
+
|
|
586
|
+
def __init__(self, some_property: str) -> None:
|
|
587
|
+
self.some_property = some_property
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
__version__ = "dummy"
|
|
591
|
+
__xml_namespace__ = "https://dummy.com"
|
|
592
|
+
"""
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
(
|
|
596
|
+
symbol_table,
|
|
597
|
+
_,
|
|
598
|
+
) = tests.infer_for_schema.common.parse_to_symbol_table_and_something_cls(
|
|
599
|
+
source=source
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
_, error = infer_for_schema.infer_constraints_by_class(
|
|
603
|
+
symbol_table=symbol_table
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
assert error is not None
|
|
607
|
+
self.assertEqual(
|
|
608
|
+
"The property some_property has conflicting invariants on the length: "
|
|
609
|
+
"the minimum length, 11, contradicts the exactly expected length 3.",
|
|
610
|
+
tests.common.most_underlying_messages(error),
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
def test_conflicting_max_and_exact(self) -> None:
|
|
614
|
+
source = textwrap.dedent(
|
|
615
|
+
"""\
|
|
616
|
+
@invariant(
|
|
617
|
+
lambda self: len(self.some_property) < 10,
|
|
618
|
+
"Some property must be less than 10 characters long."
|
|
619
|
+
)
|
|
620
|
+
@invariant(
|
|
621
|
+
lambda self: len(self.some_property) == 30,
|
|
622
|
+
"Some property must be exactly 30 characters long."
|
|
623
|
+
)
|
|
624
|
+
class Something:
|
|
625
|
+
some_property: str
|
|
626
|
+
|
|
627
|
+
def __init__(self, some_property: str) -> None:
|
|
628
|
+
self.some_property = some_property
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
__version__ = "dummy"
|
|
632
|
+
__xml_namespace__ = "https://dummy.com"
|
|
633
|
+
"""
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
(
|
|
637
|
+
symbol_table,
|
|
638
|
+
_,
|
|
639
|
+
) = tests.infer_for_schema.common.parse_to_symbol_table_and_something_cls(
|
|
640
|
+
source=source
|
|
641
|
+
)
|
|
642
|
+
|
|
643
|
+
_, error = infer_for_schema.infer_constraints_by_class(
|
|
644
|
+
symbol_table=symbol_table
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
assert error is not None
|
|
648
|
+
self.assertEqual(
|
|
649
|
+
"The property some_property has conflicting invariants on the length: "
|
|
650
|
+
"the maximum length, 9, contradicts the exactly expected length 30.",
|
|
651
|
+
tests.common.most_underlying_messages(error),
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
class Test_stacking(unittest.TestCase):
|
|
656
|
+
def test_no_inheritance_involved(self) -> None:
|
|
657
|
+
source = textwrap.dedent(
|
|
658
|
+
"""\
|
|
659
|
+
@invariant(
|
|
660
|
+
lambda self: len(self.some_property) < 10,
|
|
661
|
+
"Some property must be less than 10 characters long."
|
|
662
|
+
)
|
|
663
|
+
class Something:
|
|
664
|
+
some_property: str
|
|
665
|
+
|
|
666
|
+
def __init__(self, some_property: str) -> None:
|
|
667
|
+
self.some_property = some_property
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
__version__ = "dummy"
|
|
671
|
+
__xml_namespace__ = "https://dummy.com"
|
|
672
|
+
"""
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
# NOTE (mristin, 2022-05-18):
|
|
676
|
+
# This definition here is necessary for mypy.
|
|
677
|
+
# noinspection PyUnusedLocal
|
|
678
|
+
constraints_by_class: Optional[
|
|
679
|
+
MutableMapping[
|
|
680
|
+
intermediate.ClassUnion, infer_for_schema.ConstraintsByProperty
|
|
681
|
+
]
|
|
682
|
+
] = None
|
|
683
|
+
|
|
684
|
+
# fmt: off
|
|
685
|
+
(
|
|
686
|
+
symbol_table,
|
|
687
|
+
something_cls,
|
|
688
|
+
constraints_by_class,
|
|
689
|
+
) = (
|
|
690
|
+
tests.infer_for_schema.common
|
|
691
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
692
|
+
source=source
|
|
693
|
+
)
|
|
694
|
+
)
|
|
695
|
+
# fmt: on
|
|
696
|
+
|
|
697
|
+
constraints_by_class, error = infer_for_schema.merge_constraints_with_ancestors(
|
|
698
|
+
symbol_table=symbol_table, constraints_by_class=constraints_by_class
|
|
699
|
+
)
|
|
700
|
+
assert error is None, tests.common.most_underlying_messages(error)
|
|
701
|
+
assert constraints_by_class is not None
|
|
702
|
+
|
|
703
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
704
|
+
|
|
705
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
706
|
+
self.assertEqual(
|
|
707
|
+
textwrap.dedent(
|
|
708
|
+
"""\
|
|
709
|
+
ConstraintsByProperty(
|
|
710
|
+
len_constraints_by_property={
|
|
711
|
+
'some_property': LenConstraint(
|
|
712
|
+
min_value=None,
|
|
713
|
+
max_value=9)},
|
|
714
|
+
patterns_by_property={},
|
|
715
|
+
set_of_primitives_by_property={},
|
|
716
|
+
set_of_enumeration_literals_by_property={})"""
|
|
717
|
+
),
|
|
718
|
+
text,
|
|
719
|
+
)
|
|
720
|
+
|
|
721
|
+
def test_inheritance_from_parent_with_no_patterns_of_own(self) -> None:
|
|
722
|
+
source = textwrap.dedent(
|
|
723
|
+
"""\
|
|
724
|
+
@invariant(
|
|
725
|
+
lambda self: len(self.some_property) > 3,
|
|
726
|
+
"Some property must be more than 3 characters long."
|
|
727
|
+
)
|
|
728
|
+
class Parent:
|
|
729
|
+
some_property: str
|
|
730
|
+
|
|
731
|
+
def __init__(self, some_property: str) -> None:
|
|
732
|
+
self.some_property = some_property
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
class Something(Parent):
|
|
736
|
+
def __init__(self, some_property: str) -> None:
|
|
737
|
+
Parent.__init__(
|
|
738
|
+
self,
|
|
739
|
+
some_property=some_property
|
|
740
|
+
)
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
__version__ = "dummy"
|
|
744
|
+
__xml_namespace__ = "https://dummy.com"
|
|
745
|
+
"""
|
|
746
|
+
)
|
|
747
|
+
|
|
748
|
+
# NOTE (mristin, 2022-05-18):
|
|
749
|
+
# This definition here is necessary for mypy.
|
|
750
|
+
# noinspection PyUnusedLocal
|
|
751
|
+
constraints_by_class: Optional[
|
|
752
|
+
MutableMapping[
|
|
753
|
+
intermediate.ClassUnion, infer_for_schema.ConstraintsByProperty
|
|
754
|
+
]
|
|
755
|
+
] = None
|
|
756
|
+
|
|
757
|
+
# fmt: off
|
|
758
|
+
(
|
|
759
|
+
symbol_table,
|
|
760
|
+
something_cls,
|
|
761
|
+
constraints_by_class,
|
|
762
|
+
) = (
|
|
763
|
+
tests.infer_for_schema.common
|
|
764
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
765
|
+
source=source
|
|
766
|
+
)
|
|
767
|
+
)
|
|
768
|
+
# fmt: on
|
|
769
|
+
|
|
770
|
+
constraints_by_class, error = infer_for_schema.merge_constraints_with_ancestors(
|
|
771
|
+
symbol_table=symbol_table, constraints_by_class=constraints_by_class
|
|
772
|
+
)
|
|
773
|
+
assert error is None, tests.common.most_underlying_messages(error)
|
|
774
|
+
assert constraints_by_class is not None
|
|
775
|
+
|
|
776
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
777
|
+
|
|
778
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
779
|
+
self.assertEqual(
|
|
780
|
+
textwrap.dedent(
|
|
781
|
+
"""\
|
|
782
|
+
ConstraintsByProperty(
|
|
783
|
+
len_constraints_by_property={
|
|
784
|
+
'some_property': LenConstraint(
|
|
785
|
+
min_value=4,
|
|
786
|
+
max_value=None)},
|
|
787
|
+
patterns_by_property={},
|
|
788
|
+
set_of_primitives_by_property={},
|
|
789
|
+
set_of_enumeration_literals_by_property={})"""
|
|
790
|
+
),
|
|
791
|
+
text,
|
|
792
|
+
)
|
|
793
|
+
|
|
794
|
+
def test_merge_with_parent(self) -> None:
|
|
795
|
+
source = textwrap.dedent(
|
|
796
|
+
"""\
|
|
797
|
+
@invariant(
|
|
798
|
+
lambda self: len(self.some_property) > 3,
|
|
799
|
+
"Some property must be more than 3 characters long."
|
|
800
|
+
)
|
|
801
|
+
class Parent:
|
|
802
|
+
some_property: str
|
|
803
|
+
|
|
804
|
+
def __init__(self, some_property: str) -> None:
|
|
805
|
+
self.some_property = some_property
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
@invariant(
|
|
809
|
+
lambda self: len(self.some_property) < 10,
|
|
810
|
+
"Some property must be less than 10 characters long."
|
|
811
|
+
)
|
|
812
|
+
class Something(Parent):
|
|
813
|
+
def __init__(self, some_property: str) -> None:
|
|
814
|
+
Parent.__init__(
|
|
815
|
+
self,
|
|
816
|
+
some_property=some_property
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
__version__ = "dummy"
|
|
821
|
+
__xml_namespace__ = "https://dummy.com"
|
|
822
|
+
"""
|
|
823
|
+
)
|
|
824
|
+
|
|
825
|
+
# NOTE (mristin, 2022-05-18):
|
|
826
|
+
# This definition here is necessary for mypy.
|
|
827
|
+
# noinspection PyUnusedLocal
|
|
828
|
+
constraints_by_class: Optional[
|
|
829
|
+
MutableMapping[
|
|
830
|
+
intermediate.ClassUnion, infer_for_schema.ConstraintsByProperty
|
|
831
|
+
]
|
|
832
|
+
] = None
|
|
833
|
+
|
|
834
|
+
# fmt: off
|
|
835
|
+
(
|
|
836
|
+
symbol_table,
|
|
837
|
+
something_cls,
|
|
838
|
+
constraints_by_class,
|
|
839
|
+
) = (
|
|
840
|
+
tests.infer_for_schema.common
|
|
841
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
842
|
+
source=source
|
|
843
|
+
)
|
|
844
|
+
)
|
|
845
|
+
# fmt: on
|
|
846
|
+
|
|
847
|
+
constraints_by_class, error = infer_for_schema.merge_constraints_with_ancestors(
|
|
848
|
+
symbol_table=symbol_table, constraints_by_class=constraints_by_class
|
|
849
|
+
)
|
|
850
|
+
assert error is None, tests.common.most_underlying_messages(error)
|
|
851
|
+
assert constraints_by_class is not None
|
|
852
|
+
|
|
853
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
854
|
+
|
|
855
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
856
|
+
self.assertEqual(
|
|
857
|
+
textwrap.dedent(
|
|
858
|
+
"""\
|
|
859
|
+
ConstraintsByProperty(
|
|
860
|
+
len_constraints_by_property={
|
|
861
|
+
'some_property': LenConstraint(
|
|
862
|
+
min_value=4,
|
|
863
|
+
max_value=9)},
|
|
864
|
+
patterns_by_property={},
|
|
865
|
+
set_of_primitives_by_property={},
|
|
866
|
+
set_of_enumeration_literals_by_property={})"""
|
|
867
|
+
),
|
|
868
|
+
text,
|
|
869
|
+
)
|
|
870
|
+
|
|
871
|
+
def test_invariant_on_inherited_property(self) -> None:
|
|
872
|
+
# NOTE (mristin, 2023-02-04):
|
|
873
|
+
# We encountered a bug when designing V3.0. The schema constraints on
|
|
874
|
+
# the descendant classes where not inferred if an invariant involved properties
|
|
875
|
+
# inherited from the parent class.
|
|
876
|
+
#
|
|
877
|
+
# This unit test illustrates the setting, and prevents regressions.
|
|
878
|
+
|
|
879
|
+
source = textwrap.dedent(
|
|
880
|
+
"""\
|
|
881
|
+
@abstract
|
|
882
|
+
class Abstract_lang_string(DBC):
|
|
883
|
+
text: str
|
|
884
|
+
|
|
885
|
+
def __init__(
|
|
886
|
+
self, text: str
|
|
887
|
+
) -> None:
|
|
888
|
+
self.text = text
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
@invariant(
|
|
892
|
+
lambda self: len(self.text) <= 128,
|
|
893
|
+
"String shall have a maximum length of 128 characters."
|
|
894
|
+
)
|
|
895
|
+
class Something(Abstract_lang_string, DBC):
|
|
896
|
+
def __init__(
|
|
897
|
+
self, text: str
|
|
898
|
+
) -> None:
|
|
899
|
+
Abstract_lang_string.__init__(self, text=text)
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
__version__ = "dummy"
|
|
903
|
+
__xml_namespace__ = "https://dummy.com"
|
|
904
|
+
"""
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
# NOTE (mristin, 2023-02-04):
|
|
908
|
+
# This definition here is necessary for mypy.
|
|
909
|
+
# noinspection PyUnusedLocal
|
|
910
|
+
constraints_by_class: Optional[
|
|
911
|
+
MutableMapping[
|
|
912
|
+
intermediate.ClassUnion, infer_for_schema.ConstraintsByProperty
|
|
913
|
+
]
|
|
914
|
+
] = None
|
|
915
|
+
|
|
916
|
+
# fmt: off
|
|
917
|
+
(
|
|
918
|
+
symbol_table,
|
|
919
|
+
something_cls,
|
|
920
|
+
constraints_by_class,
|
|
921
|
+
) = (
|
|
922
|
+
tests.infer_for_schema.common
|
|
923
|
+
.parse_to_symbol_table_and_something_cls_and_constraints_by_class(
|
|
924
|
+
source=source
|
|
925
|
+
)
|
|
926
|
+
)
|
|
927
|
+
# fmt: on
|
|
928
|
+
|
|
929
|
+
constraints_by_class, error = infer_for_schema.merge_constraints_with_ancestors(
|
|
930
|
+
symbol_table=symbol_table, constraints_by_class=constraints_by_class
|
|
931
|
+
)
|
|
932
|
+
assert error is None, tests.common.most_underlying_messages(error)
|
|
933
|
+
assert constraints_by_class is not None
|
|
934
|
+
|
|
935
|
+
constraints_by_props = constraints_by_class[something_cls]
|
|
936
|
+
|
|
937
|
+
text = infer_for_schema.dump(constraints_by_props)
|
|
938
|
+
self.assertEqual(
|
|
939
|
+
textwrap.dedent(
|
|
940
|
+
"""\
|
|
941
|
+
ConstraintsByProperty(
|
|
942
|
+
len_constraints_by_property={
|
|
943
|
+
'text': LenConstraint(
|
|
944
|
+
min_value=None,
|
|
945
|
+
max_value=128)},
|
|
946
|
+
patterns_by_property={},
|
|
947
|
+
set_of_primitives_by_property={},
|
|
948
|
+
set_of_enumeration_literals_by_property={})"""
|
|
949
|
+
),
|
|
950
|
+
text,
|
|
951
|
+
)
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
if __name__ == "__main__":
|
|
955
|
+
unittest.main()
|