From 8dee9ec2533f88626ebe8385869ae5e578232cb1 Mon Sep 17 00:00:00 2001 From: cre-os Date: Mon, 28 Apr 2025 10:53:26 +0200 Subject: [PATCH] Fix models tree repr Add a test for stable source and target tree repr --- pyproject.toml | 2 +- src/xml2db/model.py | 22 +- src/xml2db/table/table.py | 13 + .../junit10/junit10_source_tree_version0.txt | 241 +++++++++++++ .../junit10/junit10_source_tree_version1.txt | 241 +++++++++++++ .../junit10/junit10_target_tree_version0.txt | 240 +++++++++++++ .../junit10/junit10_target_tree_version1.txt | 241 +++++++++++++ tests/sample_models/models.py | 16 + .../orders/orders_source_tree_version0.txt | 53 +++ .../orders/orders_source_tree_version1.txt | 53 +++ .../orders/orders_source_tree_version2.txt | 53 +++ .../orders/orders_target_tree_version0.txt | 45 +++ .../orders/orders_target_tree_version1.txt | 47 +++ .../orders/orders_target_tree_version2.txt | 45 +++ .../table1/table1_source_tree_version0.txt | 322 ++++++++++++++++++ .../table1/table1_source_tree_version1.txt | 322 ++++++++++++++++++ .../table1/table1_target_tree_version0.txt | 247 ++++++++++++++ .../table1/table1_target_tree_version1.txt | 247 ++++++++++++++ tests/test_models_output.py | 27 +- 19 files changed, 2446 insertions(+), 31 deletions(-) create mode 100644 tests/sample_models/junit10/junit10_source_tree_version0.txt create mode 100644 tests/sample_models/junit10/junit10_source_tree_version1.txt create mode 100644 tests/sample_models/junit10/junit10_target_tree_version0.txt create mode 100644 tests/sample_models/junit10/junit10_target_tree_version1.txt create mode 100644 tests/sample_models/orders/orders_source_tree_version0.txt create mode 100644 tests/sample_models/orders/orders_source_tree_version1.txt create mode 100644 tests/sample_models/orders/orders_source_tree_version2.txt create mode 100644 tests/sample_models/orders/orders_target_tree_version0.txt create mode 100644 tests/sample_models/orders/orders_target_tree_version1.txt create mode 100644 tests/sample_models/orders/orders_target_tree_version2.txt create mode 100644 tests/sample_models/table1/table1_source_tree_version0.txt create mode 100644 tests/sample_models/table1/table1_source_tree_version1.txt create mode 100644 tests/sample_models/table1/table1_target_tree_version0.txt create mode 100644 tests/sample_models/table1/table1_target_tree_version1.txt diff --git a/pyproject.toml b/pyproject.toml index dec8581..6360f7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "xml2db" -version = "0.12.4" +version = "0.12.5" authors = [ { name="Commission de régulation de l'énergie", email="opensource@cre.fr" }, ] diff --git a/src/xml2db/model.py b/src/xml2db/model.py index 09dcf39..fd666d4 100644 --- a/src/xml2db/model.py +++ b/src/xml2db/model.py @@ -230,7 +230,7 @@ def _build_model(self): ) self.root_table = root_table.type_name # compute a text representation of the original data model and store it - self.source_tree = "\n".join(self._repr_tree(root_table)) + self.source_tree = str(root_table) # check user-provided configuration for tables for tb_config in self.model_config.get("tables", {}): if tb_config not in self.names_types_map: @@ -245,7 +245,7 @@ def _build_model(self): key: tb for key, tb in self.tables.items() if hasattr(tb, "keep_table") } # compute a text representation of the simplified data model and store it - self.target_tree = "\n".join(self._repr_tree(root_table)) + self.target_tree = str(root_table) # add parent table information on each table when it is not reused # raises an error if a table is not configured as "reused" and have more than 1 parent table for tb in self.tables.values(): @@ -572,24 +572,6 @@ def get_occurs(particle): return parent_table - def _repr_tree( - self, - parent_table: Union[DataModelTableReused, DataModelTableDuplicated], - ): - """Build a text representation of the data model tree - - Args: - parent_table: the current data model table object - """ - for field_type, name, field in parent_table.fields: - if field_type == "col": - yield f"{field.name}{field.occurs}: {field.data_type}" - else: - mg = " (choice)" if field.other_table.model_group == "choice" else "" - yield f"{field.name}{field.occurs}{mg}:" - for line in self._repr_tree(field.other_table): - yield f" {line}" - def get_entity_rel_diagram(self, text_context: bool = True) -> str: """Build an entity relationship diagram for the data model diff --git a/src/xml2db/table/table.py b/src/xml2db/table/table.py index 65d831d..6e11a24 100644 --- a/src/xml2db/table/table.py +++ b/src/xml2db/table/table.py @@ -224,6 +224,19 @@ def add_relation_n(self, name, other_table, occurs, ngroup): self.fields.append(("reln", name, rel)) other_table.parents_n.add(rel) + def __repr__(self): + """Build a text representation of a table recursively""" + lines = [f"{self.name}:"] + for field_type, name, field in self.fields: + if field_type == "col": + lines.append(f" {field.name}{field.occurs}: {field.data_type}") + else: + mg = " (choice)" if field.other_table.model_group == "choice" else "" + lines.append(f" {field.name}{field.occurs}{mg}:") + for line in str(field.other_table).split("\n")[1:]: + lines.append(f" {line}") + return "\n".join(lines) + def compute_dependencies(self) -> None: """Compute the table's dependencies according to foreign keys relationships. diff --git a/tests/sample_models/junit10/junit10_source_tree_version0.txt b/tests/sample_models/junit10/junit10_source_tree_version0.txt new file mode 100644 index 0000000..afe50ef --- /dev/null +++ b/tests/sample_models/junit10/junit10_source_tree_version0.txt @@ -0,0 +1,241 @@ +junit10: + error[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + flakyError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + properties[1, 1]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + property[1, 1]: + name[0, 1]: string + value[0, 1]: string + rerunError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + skipped[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + system-err[1, 1]: string + system-out[1, 1]: string + testcase[1, 1]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + testsuite[1, 1] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string + testsuites[1, 1]: + name[0, 1]: string + time[0, 1]: string + tests[0, 1]: string + failures[0, 1]: string + errors[0, 1]: string + testsuite[0, None] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string \ No newline at end of file diff --git a/tests/sample_models/junit10/junit10_source_tree_version1.txt b/tests/sample_models/junit10/junit10_source_tree_version1.txt new file mode 100644 index 0000000..afe50ef --- /dev/null +++ b/tests/sample_models/junit10/junit10_source_tree_version1.txt @@ -0,0 +1,241 @@ +junit10: + error[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + flakyError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + properties[1, 1]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + property[1, 1]: + name[0, 1]: string + value[0, 1]: string + rerunError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + skipped[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + system-err[1, 1]: string + system-out[1, 1]: string + testcase[1, 1]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + testsuite[1, 1] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string + testsuites[1, 1]: + name[0, 1]: string + time[0, 1]: string + tests[0, 1]: string + failures[0, 1]: string + errors[0, 1]: string + testsuite[0, None] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string \ No newline at end of file diff --git a/tests/sample_models/junit10/junit10_target_tree_version0.txt b/tests/sample_models/junit10/junit10_target_tree_version0.txt new file mode 100644 index 0000000..a24616a --- /dev/null +++ b/tests/sample_models/junit10/junit10_target_tree_version0.txt @@ -0,0 +1,240 @@ +junit10: + error[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + flakyError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + properties[1, 1]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + property[1, 1]: + name[0, 1]: string + value[0, 1]: string + rerunError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + skipped[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + system-err[1, 1]: string + system-out[1, 1]: string + testcase[1, 1]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + testsuite[1, 1] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string + testsuites_name[0, 1]: string + testsuites_time[0, 1]: string + testsuites_tests[0, 1]: string + testsuites_failures[0, 1]: string + testsuites_errors[0, 1]: string + testsuites_testsuite[0, None] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string \ No newline at end of file diff --git a/tests/sample_models/junit10/junit10_target_tree_version1.txt b/tests/sample_models/junit10/junit10_target_tree_version1.txt new file mode 100644 index 0000000..afe50ef --- /dev/null +++ b/tests/sample_models/junit10/junit10_target_tree_version1.txt @@ -0,0 +1,241 @@ +junit10: + error[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + flakyError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + properties[1, 1]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + property[1, 1]: + name[0, 1]: string + value[0, 1]: string + rerunError[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunFailure[1, 1]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + skipped[1, 1]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + system-err[1, 1]: string + system-out[1, 1]: string + testcase[1, 1]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + testsuite[1, 1] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string + testsuites[1, 1]: + name[0, 1]: string + time[0, 1]: string + tests[0, 1]: string + failures[0, 1]: string + errors[0, 1]: string + testsuite[0, None] (choice): + name[0, 1]: string + errors[0, 1]: string + failures[0, 1]: string + skipped[0, 1]: string + tests[0, 1]: string + group[0, 1]: string + time[0, 1]: string + timestamp[0, 1]: string + hostname[0, 1]: string + id[0, 1]: string + package[0, 1]: string + file[0, 1]: string + log[0, 1]: string + url[0, 1]: string + version[0, 1]: string + properties[0, None]: + property[0, None]: + name[0, 1]: string + value[0, 1]: string + testcase[0, None]: + classname[0, 1]: string + name[0, 1]: string + time[0, 1]: string + group[0, 1]: string + skipped[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + error[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + failure[0, None]: + type[0, 1]: string + message[0, 1]: string + value[0, 1]: string + rerunFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + rerunError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyFailure[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + flakyError[0, None]: + message[0, 1]: string + type[0, 1]: string + stackTrace[0, 1]: string + system-out[0, 1]: string + system-err[0, 1]: string + value[0, 1]: string + system-out[0, None]: string + system-err[0, None]: string + system-out[0, None]: string + system-err[0, None]: string \ No newline at end of file diff --git a/tests/sample_models/models.py b/tests/sample_models/models.py index bda579c..965b1db 100644 --- a/tests/sample_models/models.py +++ b/tests/sample_models/models.py @@ -213,6 +213,22 @@ def _generate_models_output(): f.write("```mermaid\n") f.write(model.get_entity_rel_diagram(text_context=False)) f.write("\n```") + with open( + os.path.join( + os.path.dirname(xsd_path), + f"{model_config['id']}_source_tree_version{i}.txt", + ), + "wt", + ) as f: + f.write(model.source_tree) + with open( + os.path.join( + os.path.dirname(xsd_path), + f"{model_config['id']}_target_tree_version{i}.txt", + ), + "wt", + ) as f: + f.write(model.target_tree) if __name__ == "__main__": diff --git a/tests/sample_models/orders/orders_source_tree_version0.txt b/tests/sample_models/orders/orders_source_tree_version0.txt new file mode 100644 index 0000000..af4280e --- /dev/null +++ b/tests/sample_models/orders/orders_source_tree_version0.txt @@ -0,0 +1,53 @@ +orders: + batch_id[0, 1]: string + version[1, 1]: int + shiporder[0, None]: + orderid[0, 1]: string + processed_at[0, 1]: dateTime + orderperson[1, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip[1, 1]: + codingSystem[0, 1]: string + state[0, 1]: string + value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId[0, 1] (choice): + ace[0, 1]: string + bic[0, 1]: string + lei[0, 1]: string + coordinates[0, 1]: string + shipto[0, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip[1, 1]: + codingSystem[0, 1]: string + state[0, 1]: string + value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId[0, 1] (choice): + ace[0, 1]: string + bic[0, 1]: string + lei[0, 1]: string + coordinates[0, 1]: string + item[1, None]: + product[1, 1]: + name[1, 1]: string + version[1, 1]: string + features[0, 1]: + intfeature[0, None]: + id[1, 1]: string + value[1, 1]: integer + stringfeature[0, None]: + id[1, 1]: string + value[1, 1]: string + note[0, 1]: string + quantity[1, 1]: integer + price[1, 1]: decimal + currency[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_source_tree_version1.txt b/tests/sample_models/orders/orders_source_tree_version1.txt new file mode 100644 index 0000000..af4280e --- /dev/null +++ b/tests/sample_models/orders/orders_source_tree_version1.txt @@ -0,0 +1,53 @@ +orders: + batch_id[0, 1]: string + version[1, 1]: int + shiporder[0, None]: + orderid[0, 1]: string + processed_at[0, 1]: dateTime + orderperson[1, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip[1, 1]: + codingSystem[0, 1]: string + state[0, 1]: string + value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId[0, 1] (choice): + ace[0, 1]: string + bic[0, 1]: string + lei[0, 1]: string + coordinates[0, 1]: string + shipto[0, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip[1, 1]: + codingSystem[0, 1]: string + state[0, 1]: string + value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId[0, 1] (choice): + ace[0, 1]: string + bic[0, 1]: string + lei[0, 1]: string + coordinates[0, 1]: string + item[1, None]: + product[1, 1]: + name[1, 1]: string + version[1, 1]: string + features[0, 1]: + intfeature[0, None]: + id[1, 1]: string + value[1, 1]: integer + stringfeature[0, None]: + id[1, 1]: string + value[1, 1]: string + note[0, 1]: string + quantity[1, 1]: integer + price[1, 1]: decimal + currency[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_source_tree_version2.txt b/tests/sample_models/orders/orders_source_tree_version2.txt new file mode 100644 index 0000000..af4280e --- /dev/null +++ b/tests/sample_models/orders/orders_source_tree_version2.txt @@ -0,0 +1,53 @@ +orders: + batch_id[0, 1]: string + version[1, 1]: int + shiporder[0, None]: + orderid[0, 1]: string + processed_at[0, 1]: dateTime + orderperson[1, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip[1, 1]: + codingSystem[0, 1]: string + state[0, 1]: string + value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId[0, 1] (choice): + ace[0, 1]: string + bic[0, 1]: string + lei[0, 1]: string + coordinates[0, 1]: string + shipto[0, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip[1, 1]: + codingSystem[0, 1]: string + state[0, 1]: string + value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId[0, 1] (choice): + ace[0, 1]: string + bic[0, 1]: string + lei[0, 1]: string + coordinates[0, 1]: string + item[1, None]: + product[1, 1]: + name[1, 1]: string + version[1, 1]: string + features[0, 1]: + intfeature[0, None]: + id[1, 1]: string + value[1, 1]: integer + stringfeature[0, None]: + id[1, 1]: string + value[1, 1]: string + note[0, 1]: string + quantity[1, 1]: integer + price[1, 1]: decimal + currency[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_target_tree_version0.txt b/tests/sample_models/orders/orders_target_tree_version0.txt new file mode 100644 index 0000000..c121bc6 --- /dev/null +++ b/tests/sample_models/orders/orders_target_tree_version0.txt @@ -0,0 +1,45 @@ +orders: + batch_id[0, 1]: string + version[1, 1]: int + shiporder[0, None]: + orderid[0, 1]: string + processed_at[0, 1]: dateTime + orderperson[1, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip_codingSystem[0, 1]: string + zip_state[0, 1]: string + zip_value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId_type[0, 1]: string + companyId_value[0, 1]: string + coordinates[0, 1]: string + shipto[0, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip_codingSystem[0, 1]: string + zip_state[0, 1]: string + zip_value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId_type[0, 1]: string + companyId_value[0, 1]: string + coordinates[0, 1]: string + item[1, None]: + product_name[1, 1]: string + product_version[1, 1]: string + product_features_intfeature[0, None]: + id[1, 1]: string + value[1, 1]: integer + product_features_stringfeature[0, None]: + id[1, 1]: string + value[1, 1]: string + note[0, 1]: string + quantity[1, 1]: integer + price[1, 1]: decimal + currency[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_target_tree_version1.txt b/tests/sample_models/orders/orders_target_tree_version1.txt new file mode 100644 index 0000000..ae03934 --- /dev/null +++ b/tests/sample_models/orders/orders_target_tree_version1.txt @@ -0,0 +1,47 @@ +orders: + batch_id[0, 1]: string + version[1, 1]: int + shiporder[0, None]: + orderid[0, 1]: string + processed_at[0, 1]: dateTime + orderperson[1, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip_codingSystem[0, 1]: string + zip_state[0, 1]: string + zip_value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId_ace[0, 1]: string + companyId_bic[0, 1]: string + companyId_lei[0, 1]: string + coordinates[0, 1]: string + shipto[0, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip_codingSystem[0, 1]: string + zip_state[0, 1]: string + zip_value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId_ace[0, 1]: string + companyId_bic[0, 1]: string + companyId_lei[0, 1]: string + coordinates[0, 1]: string + item[1, None]: + product_name[1, 1]: string + product_version[1, 1]: string + product_features_intfeature[0, None]: + id[1, 1]: string + value[1, 1]: integer + product_features_stringfeature[0, None]: + id[1, 1]: string + value[1, 1]: string + note[0, 1]: string + quantity[1, 1]: integer + price[1, 1]: decimal + currency[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/orders/orders_target_tree_version2.txt b/tests/sample_models/orders/orders_target_tree_version2.txt new file mode 100644 index 0000000..be4f12d --- /dev/null +++ b/tests/sample_models/orders/orders_target_tree_version2.txt @@ -0,0 +1,45 @@ +orders: + batch_id[0, 1]: string + version[1, 1]: int + shiporder[0, None]: + orderid[0, 1]: string + processed_at[0, 1]: dateTime + orderperson_name_attr[0, 1]: string + orderperson_name[1, 1]: string + orderperson_address[1, 1]: string + orderperson_city[1, 1]: string + orderperson_zip_codingSystem[0, 1]: string + orderperson_zip_state[0, 1]: string + orderperson_zip_value[0, 1]: string + orderperson_country[1, 1]: string + orderperson_phoneNumber[0, None]: string + orderperson_companyId_type[0, 1]: string + orderperson_companyId_value[0, 1]: string + orderperson_coordinates[0, 1]: string + shipto[0, 1]: + name_attr[0, 1]: string + name[1, 1]: string + address[1, 1]: string + city[1, 1]: string + zip_codingSystem[0, 1]: string + zip_state[0, 1]: string + zip_value[0, 1]: string + country[1, 1]: string + phoneNumber[0, None]: string + companyId_type[0, 1]: string + companyId_value[0, 1]: string + coordinates[0, 1]: string + item[1, None]: + product[1, 1]: + name[1, 1]: string + version[1, 1]: string + features_intfeature[0, None]: + id[1, 1]: string + value[1, 1]: integer + features_stringfeature[0, None]: + id[1, 1]: string + value[1, 1]: string + note[0, 1]: string + quantity[1, 1]: integer + price[1, 1]: decimal + currency[1, 1]: string \ No newline at end of file diff --git a/tests/sample_models/table1/table1_source_tree_version0.txt b/tests/sample_models/table1/table1_source_tree_version0.txt new file mode 100644 index 0000000..710da29 --- /dev/null +++ b/tests/sample_models/table1/table1_source_tree_version0.txt @@ -0,0 +1,322 @@ +REMITTable1: + reportingEntityID[1, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + contractList[0, 1]: + contract[1, None]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + OrderList[0, 1]: + OrderReport[1, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant[1, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + traderID[1, 1] (choice): + traderIdForOrganisedMarket[0, 1]: string + traderIdForMarketParticipant[0, 1]: string + beneficiaryIdentification[0, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + orderId[1, 1]: + uniqueOrderIdentifier[1, 1]: string + previousOrderIdentifier[0, 1]: string + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + triggerDetails[0, 1]: + priceLimit[1, 1]: + value[1, 1]: decimal + currency[1, 1]: string + triggerContractId[0, 1]: string + undisclosedVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + orderDuration[1, 1]: + duration[1, 1]: string + expirationDateTime[0, 1]: dateTime + contractInfo[1, 1] (choice): + contractId[0, 1]: string + legContractId[0, None]: + contractId[1, 1]: string + buySellIndicator[1, 1]: string + contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + legContract[0, None]: + contract[1, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + buySellIndicator[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + transactionTime[1, 1]: dateTime + originalEntryTime[0, 1]: dateTime + linkedOrderId[0, None]: string + priceDetails[0, 1]: + price[1, 1]: decimal + priceCurrency[1, 1]: string + notionalAmountDetails[0, 1]: + notionalAmount[1, 1]: decimal + notionalCurrency[1, 1]: string + quantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + totalNotionalContractQuantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string + TradeList[0, 1]: + TradeReport[1, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant[1, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + traderID[0, 1] (choice): + traderIdForOrganisedMarket[0, 1]: string + traderIdForMarketParticipant[0, 1]: string + otherMarketParticipant[0, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + beneficiaryIdentification[0, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + aggressor[0, 1]: string + clickAndTradeDetails[0, 1]: + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + triggerDetails[0, 1]: + priceLimit[1, 1]: + value[1, 1]: decimal + currency[1, 1]: string + triggerContractId[0, 1]: string + undisclosedVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + orderDuration[0, 1]: + duration[1, 1]: string + expirationDateTime[0, 1]: dateTime + contractInfo[1, 1] (choice): + contractId[0, 1]: string + contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + transactionTime[1, 1]: dateTime + executionTime[0, 1]: dateTime + uniqueTransactionIdentifier[1, 1]: + uniqueTransactionIdentifier[1, 1]: string + additionalUtiInfo[0, 1]: string + linkedTransactionId[0, None]: string + linkedOrderId[0, None]: string + voiceBrokered[0, 1]: string + priceDetails[0, 1]: + price[1, 1]: decimal + priceCurrency[1, 1]: string + notionalAmountDetails[0, 1]: + notionalAmount[1, 1]: decimal + notionalCurrency[1, 1]: string + quantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + totalNotionalContractQuantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + terminationDate[0, 1]: dateTime + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string \ No newline at end of file diff --git a/tests/sample_models/table1/table1_source_tree_version1.txt b/tests/sample_models/table1/table1_source_tree_version1.txt new file mode 100644 index 0000000..710da29 --- /dev/null +++ b/tests/sample_models/table1/table1_source_tree_version1.txt @@ -0,0 +1,322 @@ +REMITTable1: + reportingEntityID[1, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + contractList[0, 1]: + contract[1, None]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + OrderList[0, 1]: + OrderReport[1, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant[1, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + traderID[1, 1] (choice): + traderIdForOrganisedMarket[0, 1]: string + traderIdForMarketParticipant[0, 1]: string + beneficiaryIdentification[0, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + orderId[1, 1]: + uniqueOrderIdentifier[1, 1]: string + previousOrderIdentifier[0, 1]: string + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + triggerDetails[0, 1]: + priceLimit[1, 1]: + value[1, 1]: decimal + currency[1, 1]: string + triggerContractId[0, 1]: string + undisclosedVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + orderDuration[1, 1]: + duration[1, 1]: string + expirationDateTime[0, 1]: dateTime + contractInfo[1, 1] (choice): + contractId[0, 1]: string + legContractId[0, None]: + contractId[1, 1]: string + buySellIndicator[1, 1]: string + contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + legContract[0, None]: + contract[1, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + buySellIndicator[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + transactionTime[1, 1]: dateTime + originalEntryTime[0, 1]: dateTime + linkedOrderId[0, None]: string + priceDetails[0, 1]: + price[1, 1]: decimal + priceCurrency[1, 1]: string + notionalAmountDetails[0, 1]: + notionalAmount[1, 1]: decimal + notionalCurrency[1, 1]: string + quantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + totalNotionalContractQuantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string + TradeList[0, 1]: + TradeReport[1, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant[1, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + traderID[0, 1] (choice): + traderIdForOrganisedMarket[0, 1]: string + traderIdForMarketParticipant[0, 1]: string + otherMarketParticipant[0, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + beneficiaryIdentification[0, 1] (choice): + ace[0, 1]: string + lei[0, 1]: string + bic[0, 1]: string + eic[0, 1]: string + gln[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + aggressor[0, 1]: string + clickAndTradeDetails[0, 1]: + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + triggerDetails[0, 1]: + priceLimit[1, 1]: + value[1, 1]: decimal + currency[1, 1]: string + triggerContractId[0, 1]: string + undisclosedVolume[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + orderDuration[0, 1]: + duration[1, 1]: string + expirationDateTime[0, 1]: dateTime + contractInfo[1, 1] (choice): + contractId[0, 1]: string + contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + organisedMarketPlaceIdentifier[1, 1] (choice): + lei[0, 1]: string + mic[0, 1]: string + ace[0, 1]: string + bil[0, 1]: string + transactionTime[1, 1]: dateTime + executionTime[0, 1]: dateTime + uniqueTransactionIdentifier[1, 1]: + uniqueTransactionIdentifier[1, 1]: string + additionalUtiInfo[0, 1]: string + linkedTransactionId[0, None]: string + linkedOrderId[0, None]: string + voiceBrokered[0, 1]: string + priceDetails[0, 1]: + price[1, 1]: decimal + priceCurrency[1, 1]: string + notionalAmountDetails[0, 1]: + notionalAmount[1, 1]: decimal + notionalCurrency[1, 1]: string + quantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + totalNotionalContractQuantity[0, 1]: + value[1, 1]: decimal + unit[1, 1]: string + terminationDate[0, 1]: dateTime + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity[0, 1]: + value[1, 1]: decimal + currency[1, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string \ No newline at end of file diff --git a/tests/sample_models/table1/table1_target_tree_version0.txt b/tests/sample_models/table1/table1_target_tree_version0.txt new file mode 100644 index 0000000..552cb54 --- /dev/null +++ b/tests/sample_models/table1/table1_target_tree_version0.txt @@ -0,0 +1,247 @@ +REMITTable1: + reportingEntityID_type[1, 1]: string + reportingEntityID_value[1, 1]: string + contractList_contract[0, None]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + OrderList_OrderReport[0, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant_type[1, 1]: string + idOfMarketParticipant_value[1, 1]: string + traderID_traderIdForOrganisedMarket[0, 1]: string + traderID_traderIdForMarketParticipant[0, 1]: string + beneficiaryIdentification_type[0, 1]: string + beneficiaryIdentification_value[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + orderId_uniqueOrderIdentifier[1, 1]: string + orderId_previousOrderIdentifier[0, 1]: string + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume_value[0, 1]: decimal + minimumExecuteVolume_unit[0, 1]: string + triggerDetails_priceLimit_value[0, 1]: decimal + triggerDetails_priceLimit_currency[0, 1]: string + triggerDetails_triggerContractId[0, 1]: string + undisclosedVolume_value[0, 1]: decimal + undisclosedVolume_unit[0, 1]: string + orderDuration_duration[1, 1]: string + orderDuration_expirationDateTime[0, 1]: dateTime + contractInfo_contractId[0, 1]: string + contractInfo_legContractId[0, None]: + contractId[1, 1]: string + buySellIndicator[1, 1]: string + contractInfo_contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + contractInfo_legContract[0, None]: + contract[1, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + buySellIndicator[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + transactionTime[1, 1]: dateTime + originalEntryTime[0, 1]: dateTime + linkedOrderId[0, None]: string + priceDetails_price[0, 1]: decimal + priceDetails_priceCurrency[0, 1]: string + notionalAmountDetails_notionalAmount[0, 1]: decimal + notionalAmountDetails_notionalCurrency[0, 1]: string + quantity_value[0, 1]: decimal + quantity_unit[0, 1]: string + totalNotionalContractQuantity_value[0, 1]: decimal + totalNotionalContractQuantity_unit[0, 1]: string + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity_value[0, 1]: decimal + priceTimeIntervalQuantity_currency[0, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string + TradeList_TradeReport[0, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant_type[1, 1]: string + idOfMarketParticipant_value[1, 1]: string + traderID_traderIdForOrganisedMarket[0, 1]: string + traderID_traderIdForMarketParticipant[0, 1]: string + otherMarketParticipant_type[0, 1]: string + otherMarketParticipant_value[0, 1]: string + beneficiaryIdentification_type[0, 1]: string + beneficiaryIdentification_value[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + aggressor[0, 1]: string + clickAndTradeDetails[0, 1]: + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume_value[0, 1]: decimal + minimumExecuteVolume_unit[0, 1]: string + triggerDetails_priceLimit_value[0, 1]: decimal + triggerDetails_priceLimit_currency[0, 1]: string + triggerDetails_triggerContractId[0, 1]: string + undisclosedVolume_value[0, 1]: decimal + undisclosedVolume_unit[0, 1]: string + orderDuration_duration[0, 1]: string + orderDuration_expirationDateTime[0, 1]: dateTime + contractInfo_contractId[0, 1]: string + contractInfo_contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + transactionTime[1, 1]: dateTime + executionTime[0, 1]: dateTime + uniqueTransactionIdentifier_uniqueTransactionIdentifier[1, 1]: string + uniqueTransactionIdentifier_additionalUtiInfo[0, 1]: string + linkedTransactionId[0, None]: string + linkedOrderId[0, None]: string + voiceBrokered[0, 1]: string + priceDetails_price[0, 1]: decimal + priceDetails_priceCurrency[0, 1]: string + notionalAmountDetails_notionalAmount[0, 1]: decimal + notionalAmountDetails_notionalCurrency[0, 1]: string + quantity_value[0, 1]: decimal + quantity_unit[0, 1]: string + totalNotionalContractQuantity_value[0, 1]: decimal + totalNotionalContractQuantity_unit[0, 1]: string + terminationDate[0, 1]: dateTime + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity_value[0, 1]: decimal + priceTimeIntervalQuantity_currency[0, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string \ No newline at end of file diff --git a/tests/sample_models/table1/table1_target_tree_version1.txt b/tests/sample_models/table1/table1_target_tree_version1.txt new file mode 100644 index 0000000..93e4d19 --- /dev/null +++ b/tests/sample_models/table1/table1_target_tree_version1.txt @@ -0,0 +1,247 @@ +REMITTable1: + reportingEntityID_type[1, 1]: string + reportingEntityID_value[1, 1]: string + contract[0, None]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + OrderList_OrderReport[0, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant_type[1, 1]: string + idOfMarketParticipant_value[1, 1]: string + traderID_traderIdForOrganisedMarket[0, 1]: string + traderID_traderIdForMarketParticipant[0, 1]: string + beneficiaryIdentification_type[0, 1]: string + beneficiaryIdentification_value[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + orderId_uniqueOrderIdentifier[1, 1]: string + orderId_previousOrderIdentifier[0, 1]: string + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume_value[0, 1]: decimal + minimumExecuteVolume_unit[0, 1]: string + triggerDetails_priceLimit_value[0, 1]: decimal + triggerDetails_priceLimit_currency[0, 1]: string + triggerDetails_triggerContractId[0, 1]: string + undisclosedVolume_value[0, 1]: decimal + undisclosedVolume_unit[0, 1]: string + orderDuration_duration[1, 1]: string + orderDuration_expirationDateTime[0, 1]: dateTime + contractInfo_contractId[0, 1]: string + contractInfo_legContractId[0, None]: + contractId[1, 1]: string + buySellIndicator[1, 1]: string + contractInfo_contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + contractInfo_legContract[0, None]: + contract[1, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + buySellIndicator[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + transactionTime[1, 1]: dateTime + originalEntryTime[0, 1]: dateTime + linkedOrderId[0, None]: string + priceDetails_price[0, 1]: decimal + priceDetails_priceCurrency[0, 1]: string + notionalAmountDetails_notionalAmount[0, 1]: decimal + notionalAmountDetails_notionalCurrency[0, 1]: string + quantity_value[0, 1]: decimal + quantity_unit[0, 1]: string + totalNotionalContractQuantity_value[0, 1]: decimal + totalNotionalContractQuantity_unit[0, 1]: string + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity_value[0, 1]: decimal + priceTimeIntervalQuantity_currency[0, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string + TradeList_TradeReport[0, None]: + RecordSeqNumber[1, 1]: integer + idOfMarketParticipant_type[1, 1]: string + idOfMarketParticipant_value[1, 1]: string + traderID_traderIdForOrganisedMarket[0, 1]: string + traderID_traderIdForMarketParticipant[0, 1]: string + otherMarketParticipant_type[0, 1]: string + otherMarketParticipant_value[0, 1]: string + beneficiaryIdentification_type[0, 1]: string + beneficiaryIdentification_value[0, 1]: string + tradingCapacity[1, 1]: string + buySellIndicator[1, 1]: string + aggressor[0, 1]: string + clickAndTradeDetails[0, 1]: + orderType[1, 1]: string + orderCondition[0, None]: string + orderStatus[0, None]: string + minimumExecuteVolume_value[0, 1]: decimal + minimumExecuteVolume_unit[0, 1]: string + triggerDetails_priceLimit_value[0, 1]: decimal + triggerDetails_priceLimit_currency[0, 1]: string + triggerDetails_triggerContractId[0, 1]: string + undisclosedVolume_value[0, 1]: decimal + undisclosedVolume_unit[0, 1]: string + orderDuration_duration[0, 1]: string + orderDuration_expirationDateTime[0, 1]: dateTime + contractInfo_contractId[0, 1]: string + contractInfo_contract[0, 1]: + contractId[1, 1]: string + contractName[0, 1]: string + contractType[1, 1]: string + energyCommodity[1, 2]: string + fixingIndex[0, None]: + indexName[1, 1]: string + indexValue[0, 1]: decimal + settlementMethod[1, 1]: string + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + contractTradingHours[0, None]: + startTime[1, 1]: time + endTime[1, 1]: time + date[0, 1]: date + lastTradingDateTime[0, 1]: dateTime + optionDetails[0, 1]: + optionStyle[1, 1]: string + optionType[1, 1]: string + optionExerciseDate[0, None]: date + optionStrikePrice_value[0, 1]: decimal + optionStrikePrice_currency[0, 1]: string + deliveryPointOrZone[1, None]: string + deliveryStartDate[1, 1]: date + deliveryEndDate[1, 1]: date + duration[0, 1]: string + loadType[0, 1]: string + deliveryProfile[1, None]: + loadDeliveryStartDate[0, 1]: date + loadDeliveryEndDate[0, 1]: date + daysOfTheWeek[0, None]: string + loadDeliveryStartTime[1, None]: time + loadDeliveryEndTime[1, None]: time + organisedMarketPlaceIdentifier_type[1, 1]: string + organisedMarketPlaceIdentifier_value[1, 1]: string + transactionTime[1, 1]: dateTime + executionTime[0, 1]: dateTime + uniqueTransactionIdentifier_uniqueTransactionIdentifier[1, 1]: string + uniqueTransactionIdentifier_additionalUtiInfo[0, 1]: string + linkedTransactionId[0, None]: string + linkedOrderId[0, None]: string + voiceBrokered[0, 1]: string + priceDetails_price[0, 1]: decimal + priceDetails_priceCurrency[0, 1]: string + notionalAmountDetails_notionalAmount[0, 1]: decimal + notionalAmountDetails_notionalCurrency[0, 1]: string + quantity_value[0, 1]: decimal + quantity_unit[0, 1]: string + totalNotionalContractQuantity_value[0, 1]: decimal + totalNotionalContractQuantity_unit[0, 1]: string + terminationDate[0, 1]: dateTime + priceIntervalQuantityDetails[0, None]: + intervalStartDate[0, 1]: date + intervalEndDate[0, 1]: date + daysOfTheWeek[0, 1]: string + intervalStartTime[1, None]: time + intervalEndTime[1, None]: time + quantity[0, 1]: decimal + unit[0, 1]: string + priceTimeIntervalQuantity_value[0, 1]: decimal + priceTimeIntervalQuantity_currency[0, 1]: string + actionType[1, 1]: string + Extra[0, 1]: string \ No newline at end of file diff --git a/tests/test_models_output.py b/tests/test_models_output.py index b5245a0..b558fed 100644 --- a/tests/test_models_output.py +++ b/tests/test_models_output.py @@ -16,7 +16,7 @@ for i in range(len(model["versions"])) ], ) -def test_model_erd(test_config): +def test_model_text_outputs(test_config): """A test to check if generated ERD matches saved output""" model = DataModel( @@ -25,16 +25,23 @@ def test_model_erd(test_config): model_config=test_config["config"], ) - expected = open( - os.path.join( - models_path, - test_config["id"], - f"{test_config['id']}_erd_version{test_config['version_id']}.md", - ), - "r", - ).read() + expected = [ + open( + os.path.join( + models_path, + test_config["id"], + f"{test_config['id']}_{file_type}_version{test_config['version_id']}.{'md' if file_type == 'erd' else 'txt'}", + ), + "r", + ).read() + for file_type in ["erd", "source_tree", "target_tree"] + ] - actual = "```mermaid\n" + model.get_entity_rel_diagram(text_context=False) + "\n```" + actual = [ + "```mermaid\n" + model.get_entity_rel_diagram(text_context=False) + "\n```", + model.source_tree, + model.target_tree, + ] assert actual == expected