From 3e9918e8e847035d1bed4a44063b62ed52644e29 Mon Sep 17 00:00:00 2001 From: KerstenBreuer Date: Thu, 7 Dec 2023 18:03:03 +0000 Subject: [PATCH] added test cases --- tests/schemapack_/fixtures/data.py | 3 +- .../Dataset.schema.json | 17 ++++++ .../Experiment.schema.json | 17 ++++++ .../example_content_schemas/File.schema.json | 30 ++++++++++ .../Sample.schema.json | 17 ++++++ .../example_data/advanced.datapack.yaml | 56 +++++++++++++++++ ...al.datapack.yaml => minimal.datapack.yaml} | 0 .../example_models/advanced.schemapack.yaml | 31 ++++++++++ .../example_models/minimal.schemapack.yaml | 38 +----------- .../example_transformations/Readme.md | 33 ++++++++++ .../active_reference/config.yaml | 5 ++ .../transformed.datapack.yaml | 60 +++++++++++++++++++ .../transformed.schemapack.yaml | 33 ++++++++++ .../complex_reference/config.yaml | 5 ++ .../transformed.datapack.yaml | 59 ++++++++++++++++++ .../transformed.schemapack.yaml | 33 ++++++++++ .../passive_reference/config.yaml | 5 ++ .../passive_reference/input.datapack.yaml | 42 +++++++++++++ .../transformed.datapack.yaml | 51 ++++++++++++++++ .../transformed.schemapack.yaml | 34 +++++++++++ tests/schemapack_/fixtures/models.py | 6 +- tests/schemapack_/transform/test_handling.py | 28 ++++----- 22 files changed, 549 insertions(+), 54 deletions(-) create mode 100644 tests/schemapack_/fixtures/example_content_schemas/Dataset.schema.json create mode 100644 tests/schemapack_/fixtures/example_content_schemas/Experiment.schema.json create mode 100644 tests/schemapack_/fixtures/example_content_schemas/File.schema.json create mode 100644 tests/schemapack_/fixtures/example_content_schemas/Sample.schema.json create mode 100644 tests/schemapack_/fixtures/example_data/advanced.datapack.yaml rename tests/schemapack_/fixtures/example_data/{valid_minimal.datapack.yaml => minimal.datapack.yaml} (100%) create mode 100644 tests/schemapack_/fixtures/example_models/advanced.schemapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/Readme.md create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/config.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.datapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.schemapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/config.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.datapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.schemapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/config.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/input.datapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.datapack.yaml create mode 100644 tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.schemapack.yaml diff --git a/tests/schemapack_/fixtures/data.py b/tests/schemapack_/fixtures/data.py index 7074529c..3f80b1f3 100644 --- a/tests/schemapack_/fixtures/data.py +++ b/tests/schemapack_/fixtures/data.py @@ -30,5 +30,6 @@ def _get_example_data(name: str) -> DataPack: return load_datapack(EXAMPLE_DATA_DIR / f"{name}.datapack.yaml") -VALID_MINIMAL_DATA = _get_example_data("valid_minimal") +MINIMAL_DATA = _get_example_data("minimal") +ADVANCED_DATA = _get_example_data("advanced") INVALID_MINIMAL_DATA = _get_example_data("invalid_minimal") diff --git a/tests/schemapack_/fixtures/example_content_schemas/Dataset.schema.json b/tests/schemapack_/fixtures/example_content_schemas/Dataset.schema.json new file mode 100644 index 00000000..9358f832 --- /dev/null +++ b/tests/schemapack_/fixtures/example_content_schemas/Dataset.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "description": "A dataset that is a collection of files.", + "properties": { + "alias": { + "type": "string" + }, + "dac_contact": { + "type": "string" + } + }, + "required": [ + "alias" + ], + "type": "object" +} diff --git a/tests/schemapack_/fixtures/example_content_schemas/Experiment.schema.json b/tests/schemapack_/fixtures/example_content_schemas/Experiment.schema.json new file mode 100644 index 00000000..fdb2de4f --- /dev/null +++ b/tests/schemapack_/fixtures/example_content_schemas/Experiment.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "description": "An experiment containing one or multiple samples.", + "properties": { + "alias": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "alias" + ], + "type": "object" +} diff --git a/tests/schemapack_/fixtures/example_content_schemas/File.schema.json b/tests/schemapack_/fixtures/example_content_schemas/File.schema.json new file mode 100644 index 00000000..5ca385db --- /dev/null +++ b/tests/schemapack_/fixtures/example_content_schemas/File.schema.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "description": "A file is an object that contains information generated from a process, either an Experiment or an Analysis.", + "properties": { + "alias": { + "type": "string" + }, + "checksum": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "format": { + "type": "string" + }, + "size": { + "type": "integer" + } + }, + "required": [ + "alias", + "filename", + "format", + "checksum", + "size" + ], + "type": "object" +} diff --git a/tests/schemapack_/fixtures/example_content_schemas/Sample.schema.json b/tests/schemapack_/fixtures/example_content_schemas/Sample.schema.json new file mode 100644 index 00000000..54880cbf --- /dev/null +++ b/tests/schemapack_/fixtures/example_content_schemas/Sample.schema.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "description": "A sample used to generate files in the context of an experiment.", + "properties": { + "alias": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "alias" + ], + "type": "object" +} diff --git a/tests/schemapack_/fixtures/example_data/advanced.datapack.yaml b/tests/schemapack_/fixtures/example_data/advanced.datapack.yaml new file mode 100644 index 00000000..2bee3e10 --- /dev/null +++ b/tests/schemapack_/fixtures/example_data/advanced.datapack.yaml @@ -0,0 +1,56 @@ +datapack: 0.1.0 +resources: + File: + file_a: + content: + alias: file_a + filename: file_a.fastq + format: FASTQ + checksum: 1a5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92b8 + size: 12321 + file_b: + content: + alias: file_b + filename: file_b.fastq + format: FASTQ + checksum: 2b5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92c9 + size: 12314 + file_c: + content: + alias: file_c + filename: file_c.fastq + format: FASTQ + checksum: a9c24870071da03f78515e6197048f3a2172e90e597e9250cd01a0cb8f0986ed + size: 12123 + Dataset: + dataset_1: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + - file_b + - file_c + Sample: + sample_x: + content: + alias: sample_x + relations: + files: + - file_a + - file_b + sample_y: + content: + alias: sample_y + relations: + files: + - file_c + Experiment: + experiment_i: + content: + alias: experiment_i + relations: + samples: + - sample_x + - sample_y diff --git a/tests/schemapack_/fixtures/example_data/valid_minimal.datapack.yaml b/tests/schemapack_/fixtures/example_data/minimal.datapack.yaml similarity index 100% rename from tests/schemapack_/fixtures/example_data/valid_minimal.datapack.yaml rename to tests/schemapack_/fixtures/example_data/minimal.datapack.yaml diff --git a/tests/schemapack_/fixtures/example_models/advanced.schemapack.yaml b/tests/schemapack_/fixtures/example_models/advanced.schemapack.yaml new file mode 100644 index 00000000..7039d474 --- /dev/null +++ b/tests/schemapack_/fixtures/example_models/advanced.schemapack.yaml @@ -0,0 +1,31 @@ +# a simple schemapack with the content schemas being embedded +schemapack: 0.1.0 +classes: + File: + id: + from_content: alias + content: ../example_content_schemas/File.schema.json + Dataset: + id: + from_content: alias + content: ../example_content_schemas/Dataset.schema.json + relations: + files: + to: File + cardinality: many_to_many + Sample: + id: + from_content: alias + content: ../example_content_schemas/Sample.schema.json + relations: + files: + to: File + cardinality: one_to_many + Experiment: + id: + from_content: alias + content: ../example_content_schemas/Experiment.schema.json + relations: + samples: + to: Sample + cardinality: one_to_many diff --git a/tests/schemapack_/fixtures/example_models/minimal.schemapack.yaml b/tests/schemapack_/fixtures/example_models/minimal.schemapack.yaml index d79663d6..421d5982 100644 --- a/tests/schemapack_/fixtures/example_models/minimal.schemapack.yaml +++ b/tests/schemapack_/fixtures/example_models/minimal.schemapack.yaml @@ -4,45 +4,11 @@ classes: File: id: from_content: alias - content: - "$schema": "http://json-schema.org/draft-07/schema#" - additionalProperties: false - description: A file is an object that contains information generated from a process, - either an Experiment or an Analysis. - properties: - alias: - type: string - checksum: - type: string - filename: - type: string - format: - type: string - size: - type: integer - required: - - alias - - filename - - format - - checksum - - size - type: object + content: ../example_content_schemas/File.schema.json Dataset: id: from_content: alias - content: - "$schema": "http://json-schema.org/draft-07/schema#" - additionalProperties: false - description: A dataset that is a collection of files. - properties: - alias: - type: string - dac_contact: - type: string - required: - - alias - type: object - + content: ../example_content_schemas/Dataset.schema.json relations: files: to: File diff --git a/tests/schemapack_/fixtures/example_transformations/Readme.md b/tests/schemapack_/fixtures/example_transformations/Readme.md new file mode 100644 index 00000000..1ab38d08 --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/Readme.md @@ -0,0 +1,33 @@ + + +This directory contains test cases for testing builtin transformation. + +Names of sub-directories correspond to the transformation names. +Each sub-sub-directory represents a test case. +A test case is defined by following four files: +- `config.yaml` - the transformation config +- `input.datapack.yaml` - the input data for this transformation, if not present, + the [../example_data/advanced.datapack.yaml](../example_data/advanced.datapack.yaml) + is used +- `input.schemapack.yaml` - the model for the input data, if not present, + the + [../example_models/advanced.schemapack.yaml](../example_models/advanced.schemapack.yaml) + is used +- `transformed.datapack.yaml` - the expected data output of the transformation +- `transformed.schemapack.yaml` - the expected model output of the transformation diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/config.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/config.yaml new file mode 100644 index 00000000..d0488c9d --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/config.yaml @@ -0,0 +1,5 @@ +inferred_relations: + Experiment: + files: + path: "Experiment(samples)>Sample(files)>File" + expect_multiple: true diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.datapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.datapack.yaml new file mode 100644 index 00000000..e7787f8f --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.datapack.yaml @@ -0,0 +1,60 @@ +datapack: 0.1.0 +resources: + File: + file_a: + content: + alias: file_a + filename: file_a.fastq + format: FASTQ + checksum: 1a5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92b8 + size: 12321 + file_b: + content: + alias: file_b + filename: file_b.fastq + format: FASTQ + checksum: 2b5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92c9 + size: 12314 + file_c: + content: + alias: file_c + filename: file_c.fastq + format: FASTQ + checksum: a9c24870071da03f78515e6197048f3a2172e90e597e9250cd01a0cb8f0986ed + size: 12123 + Dataset: + dataset_1: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + - file_b + - file_c + Sample: + sample_x: + content: + alias: sample_x + relations: + files: + - file_a + - file_b + sample_y: + content: + alias: sample_y + relations: + files: + - file_c + Experiment: + experiment_i: + content: + alias: experiment_i + relations: + samples: + - sample_x + - sample_y + files: # <- + - file_a + - file_b + - file_c diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.schemapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.schemapack.yaml new file mode 100644 index 00000000..2d7ca2eb --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/active_reference/transformed.schemapack.yaml @@ -0,0 +1,33 @@ +schemapack: 0.1.0 +classes: + File: + id: + from_content: alias + content: ../example_content_schemas/File.schema.json + Dataset: + id: + from_content: alias + content: ../example_content_schemas/Dataset.schema.json + relations: + files: + to: File + cardinality: many_to_many + Sample: + id: + from_content: alias + content: ../example_content_schemas/Sample.schema.json + relations: + files: + to: File + cardinality: one_to_many + Experiment: + id: + from_content: alias + content: ../example_content_schemas/Experiment.schema.json + relations: + samples: + to: Sample + cardinality: one_to_many + files: # <- + to: File + cardinality: many_to_many diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/config.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/config.yaml new file mode 100644 index 00000000..018c807d --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/config.yaml @@ -0,0 +1,5 @@ +inferred_relations: + Dataset: + samples: + path: "Dataset(files)>File<(files)Sample" + expected_multiple: true diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.datapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.datapack.yaml new file mode 100644 index 00000000..d61ec4cf --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.datapack.yaml @@ -0,0 +1,59 @@ +datapack: 0.1.0 +resources: + File: + file_a: + content: + alias: file_a + filename: file_a.fastq + format: FASTQ + checksum: 1a5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92b8 + size: 12321 + file_b: + content: + alias: file_b + filename: file_b.fastq + format: FASTQ + checksum: 2b5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92c9 + size: 12314 + file_c: + content: + alias: file_c + filename: file_c.fastq + format: FASTQ + checksum: a9c24870071da03f78515e6197048f3a2172e90e597e9250cd01a0cb8f0986ed + size: 12123 + Dataset: + dataset_1: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + - file_b + - file_c + samples: + - sample_x + - sample_y + Sample: + sample_x: + content: + alias: sample_x + relations: + files: + - file_a + - file_b + sample_y: + content: + alias: sample_y + relations: + files: + - file_c + Experiment: + experiment_i: + content: + alias: experiment_i + relations: + samples: + - sample_x + - sample_y diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.schemapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.schemapack.yaml new file mode 100644 index 00000000..57b7b6f6 --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/complex_reference/transformed.schemapack.yaml @@ -0,0 +1,33 @@ +schemapack: 0.1.0 +classes: + File: + id: + from_content: alias + content: ../example_content_schemas/File.schema.json + Dataset: + id: + from_content: alias + content: ../example_content_schemas/Dataset.schema.json + relations: + files: + to: File + cardinality: many_to_many + samples: # <- + to: Sample + cardinality: many_to_many + Sample: + id: + from_content: alias + content: ../example_content_schemas/Sample.schema.json + relations: + files: + to: File + cardinality: one_to_many + Experiment: + id: + from_content: alias + content: ../example_content_schemas/Experiment.schema.json + relations: + samples: + to: Sample + cardinality: one_to_many diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/config.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/config.yaml new file mode 100644 index 00000000..0142ef28 --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/config.yaml @@ -0,0 +1,5 @@ +inferred_relations: + File: + datasets: + path: "File<(files)Dataset" + expect_multiple: true diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/input.datapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/input.datapack.yaml new file mode 100644 index 00000000..6621f596 --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/input.datapack.yaml @@ -0,0 +1,42 @@ +datapack: 0.1.0 +resources: + File: + file_a: + content: + alias: file_a + filename: file_a.fastq + format: FASTQ + checksum: 1a5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92b8 + size: 12321 + file_b: + content: + alias: file_b + filename: file_b.fastq + format: FASTQ + checksum: 2b5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92c9 + size: 12314 + file_c: + content: + alias: file_c + filename: file_c.fastq + format: FASTQ + checksum: a9c24870071da03f78515e6197048f3a2172e90e597e9250cd01a0cb8f0986ed + size: 12123 + Dataset: + dataset_1: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + - file_b + dataset_2: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + Sample: {} + Experiment: {} diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.datapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.datapack.yaml new file mode 100644 index 00000000..f274f708 --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.datapack.yaml @@ -0,0 +1,51 @@ +datapack: 0.1.0 +resources: + File: + file_a: + content: + alias: file_a + filename: file_a.fastq + format: FASTQ + checksum: 1a5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92b8 + size: 12321 + relations: # <- + datasets: + - dataset_1 + - dataset_2 + file_b: + content: + alias: file_b + filename: file_b.fastq + format: FASTQ + checksum: 2b5ac10ab42911dc0224172c118a326d9a4c03969112a2f3eb1ad971e96e92c9 + size: 12314 + relations: # <- + datasets: + - dataset_1 + file_c: + content: + alias: file_c + filename: file_c.fastq + format: FASTQ + checksum: a9c24870071da03f78515e6197048f3a2172e90e597e9250cd01a0cb8f0986ed + size: 12123 + relations: # <- + datasets: [] + Dataset: + dataset_1: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + - file_b + dataset_2: + content: + alias: dataset_1 + dac_contact: dac@example.org + relations: + files: + - file_a + Sample: {} + Experiment: {} diff --git a/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.schemapack.yaml b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.schemapack.yaml new file mode 100644 index 00000000..3664b656 --- /dev/null +++ b/tests/schemapack_/fixtures/example_transformations/infer_references/passive_reference/transformed.schemapack.yaml @@ -0,0 +1,34 @@ +schemapack: 0.1.0 +classes: + File: + id: + from_content: alias + content: ../example_content_schemas/File.schema.json + relations: # <- + datasets: + to: Dataset + cardinality: many_to_many + Dataset: + id: + from_content: alias + content: ../example_content_schemas/Dataset.schema.json + relations: + files: + to: File + cardinality: many_to_many + Sample: + id: + from_content: alias + content: ../example_content_schemas/Sample.schema.json + relations: + files: + to: File + cardinality: one_to_many + Experiment: + id: + from_content: alias + content: ../example_content_schemas/Experiment.schema.json + relations: + samples: + to: Sample + cardinality: one_to_many diff --git a/tests/schemapack_/fixtures/models.py b/tests/schemapack_/fixtures/models.py index dd9b514d..183d4388 100644 --- a/tests/schemapack_/fixtures/models.py +++ b/tests/schemapack_/fixtures/models.py @@ -22,7 +22,7 @@ from tests.schemapack_.fixtures.utils import BASE_DIR EXAMPLE_MODEL_DIR = BASE_DIR / "example_models" -VALID_MINIMAL_MODEL_EXAMPLE_PATH = EXAMPLE_MODEL_DIR / "minimal_model.yaml" +MINIMAL_MODEL_EXAMPLE_PATH = EXAMPLE_MODEL_DIR / "minimal_model.yaml" def _get_example_model(name: str) -> SchemaPack: @@ -31,5 +31,5 @@ def _get_example_model(name: str) -> SchemaPack: return load_schemapack(EXAMPLE_MODEL_DIR / f"{name}.schemapack.yaml") -VALID_MINIMAL_MODEL = _get_example_model("minimal") -VALID_MODELS = [VALID_MINIMAL_MODEL] +MINIMAL_MODEL = _get_example_model("minimal") +VALID_MODELS = [MINIMAL_MODEL] diff --git a/tests/schemapack_/transform/test_handling.py b/tests/schemapack_/transform/test_handling.py index e4248df2..12ecc043 100644 --- a/tests/schemapack_/transform/test_handling.py +++ b/tests/schemapack_/transform/test_handling.py @@ -36,8 +36,8 @@ TransformationHandler, WorkflowHandler, ) -from tests.schemapack_.fixtures.data import INVALID_MINIMAL_DATA, VALID_MINIMAL_DATA -from tests.schemapack_.fixtures.models import VALID_MINIMAL_MODEL +from tests.schemapack_.fixtures.data import INVALID_MINIMAL_DATA, MINIMAL_DATA +from tests.schemapack_.fixtures.models import MINIMAL_MODEL def test_transformation_handler_happy(): @@ -46,16 +46,16 @@ def test_transformation_handler_happy(): transformation_handler = TransformationHandler( transformation_definition=NULL_TRANSFORMATION, transformation_config=NullConfig(), - original_model=VALID_MINIMAL_MODEL, + original_model=MINIMAL_MODEL, ) # Since the null transformation was used, compare with the input: - assert transformation_handler.transformed_model == VALID_MINIMAL_MODEL + assert transformation_handler.transformed_model == MINIMAL_MODEL - transformed_data = transformation_handler.transform_data(VALID_MINIMAL_DATA) + transformed_data = transformation_handler.transform_data(MINIMAL_DATA) # Since the null transformation was used, compare with the input: - assert transformed_data == VALID_MINIMAL_DATA + assert transformed_data == MINIMAL_DATA def test_transformation_handler_assumption_error(): @@ -77,7 +77,7 @@ def always_failing_assumptions(model: SchemaPack, config: NullConfig): _ = TransformationHandler( transformation_definition=transformation, transformation_config=NullConfig(), - original_model=VALID_MINIMAL_MODEL, + original_model=MINIMAL_MODEL, ) @@ -99,7 +99,7 @@ def always_failing_transformation(original_model: SchemaPack, config: NullConfig _ = TransformationHandler( transformation_definition=transformation, transformation_config=NullConfig(), - original_model=VALID_MINIMAL_MODEL, + original_model=MINIMAL_MODEL, ) @@ -110,7 +110,7 @@ def test_transformation_handler_input_data_invalid(): transformation_handler = TransformationHandler( transformation_definition=NULL_TRANSFORMATION, transformation_config=NullConfig(), - original_model=VALID_MINIMAL_MODEL, + original_model=MINIMAL_MODEL, ) with pytest.raises(schemapack.exceptions.ValidationError): @@ -146,11 +146,11 @@ def transform(self, data: DataPack) -> DataPack: transformation_handler = TransformationHandler( transformation_definition=transformation, transformation_config=NullConfig(), - original_model=VALID_MINIMAL_MODEL, + original_model=MINIMAL_MODEL, ) with pytest.raises(schemapack.exceptions.ValidationError): - _ = transformation_handler.transform_data(VALID_MINIMAL_DATA) + _ = transformation_handler.transform_data(MINIMAL_DATA) def test_workflow_handler_happy(): @@ -180,10 +180,10 @@ def test_workflow_handler_happy(): workflow_config=null_workflow.config_cls.model_validate( {"step1": {}, "step2": {}} ), - original_model=VALID_MINIMAL_MODEL, + original_model=MINIMAL_MODEL, ) - artifacts = workflow_handler.run(data=VALID_MINIMAL_DATA) + artifacts = workflow_handler.run(data=MINIMAL_DATA) # Since a null workflow was used, compare to the input: - assert artifacts["step1_output"] == artifacts["step2_output"] == VALID_MINIMAL_DATA + assert artifacts["step1_output"] == artifacts["step2_output"] == MINIMAL_DATA