-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,14 @@ | ||
from typing import Tuple, Optional | ||
from aas_test_engines.result import AasTestResult | ||
|
||
from .parse import parse_concrete_object, check_constraints | ||
from .parse import parse_and_check_json, parse_and_check_xml | ||
from .adapter import JsonAdapter, XmlAdapter, AdapterPath | ||
from .model import Environment | ||
|
||
def _check_constraints(result_root: AasTestResult, env: Environment): | ||
if result_root.ok(): | ||
result_constraints = AasTestResult("Check constraints") | ||
check_constraints(env, result_constraints) | ||
result_root.append(result_constraints) | ||
|
||
def json_to_env(value: any) -> Tuple[AasTestResult, Optional[Environment]]: | ||
result_root = AasTestResult("Check") | ||
result_meta_model = AasTestResult("Check meta model") | ||
env: Environment = parse_concrete_object(Environment, JsonAdapter(value, AdapterPath()), result_meta_model) | ||
result_root.append(result_meta_model) | ||
_check_constraints(result_root, env) | ||
return result_root, env | ||
return parse_and_check_json(Environment, value) | ||
|
||
|
||
def xml_to_env(value: any) -> Tuple[AasTestResult, Optional[Environment]]: | ||
result_root = AasTestResult("Check") | ||
result_meta_model = AasTestResult("Check meta model") | ||
env: Environment = parse_concrete_object(Environment, XmlAdapter(value, AdapterPath()), result_meta_model) | ||
result_root.append(result_meta_model) | ||
_check_constraints(result_root, env) | ||
return result_root, env | ||
return parse_and_check_xml(Environment, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters