Skip to content
Snippets Groups Projects
Verified Commit 2fc6bf13 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

TEST: Added tests if the resulting dict is a vlaid Json schema.

parent 3c2a0285
No related branches found
No related tags found
2 merge requests!89ENH: JsonSchemaExporter accepts do_not_create parameter.,!84F more jsonschema export
......@@ -718,17 +718,23 @@ RT2:
# Merge the schemata
merged_list = jsex.merge_schemas([schema_RT1, schema_RT2])
with raises(ValidationError):
validate({}, merged_list)
assert merged_list["type"] == "object"
assert merged_list["properties"]["RT1"]["title"] == "RT1"
assert merged_list["properties"]["RT2"]["properties"]["some_text"]["type"] == "string"
merged_dict = jsex.merge_schemas({"schema1": schema_RT1, "schema2": schema_RT2})
with raises(ValidationError):
validate({}, merged_dict)
assert merged_dict["type"] == "object"
assert merged_dict["properties"]["schema1"]["title"] == "RT1"
assert merged_dict["properties"]["schema2"]["properties"]["some_text"]["type"] == "string"
# Make an array
array = jsex.make_array(schema_RT1)
with raises(ValidationError):
validate({}, array)
assert array["type"] == "array"
assert array["items"] == schema_RT1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment