Skip to content

Commit

Permalink
TST: Test Twine available strands properties
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Apr 4, 2022
1 parent 9b274c7 commit 103c4fd
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/test_twine.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,68 @@ def test_broken_json_twine(self):
with self.assertRaises(exceptions.InvalidTwineJson):
Twine(source=invalid_json_twine)

def test_available_strands_properties(self):
"""Test that the `available_strands` and `available_manifest_strands` properties work correctly."""
twine = """
{
"configuration_values_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "The example configuration form",
"description": "The configuration strand of an example twine",
"type": "object",
"properties": {
"n_iterations": {
"description": "An example of an integer configuration variable, called 'n_iterations'.",
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 5
}
}
},
"input_values_schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Input Values",
"description": "The input values strand of an example twine, with a required height value",
"type": "object",
"properties": {
"height": {
"description": "An example of an integer value called 'height'",
"type": "integer",
"minimum": 2
}
},
"required": ["height"]
},
"output_values_schema": {
"title": "Output Values",
"description": "The output values strand of an example twine",
"type": "object",
"properties": {
"width": {
"description": "An example of an integer value called 'result'",
"type": "integer",
"minimum": 2
}
}
},
"output_manifest": {
"datasets": {
"my-dataset": {}
}
}
}
"""

twine = Twine(source=twine)

self.assertEqual(
twine.available_strands,
{"configuration_values", "input_values", "output_values", "output_manifest"},
)

self.assertEqual(twine.available_manifest_strands, {"output_manifest"})

def test_deprecation_warning_issued_if_datasets_not_given_as_dictionary_in_manifest_strands(self):
"""Test that, if datasets are given as a list in the manifest strands, a deprecation warning is issued and the
list (the old form) is converted to a dictionary (the new form).
Expand Down

0 comments on commit 103c4fd

Please sign in to comment.