def test_example_json_validates(example_json42): """Test the example file validates against the JSON schema.""" example_json = load_json_path(example_json42) validator.validate(example_json)
def test_minimal_xsd(xsd42, minimal_json42): """Test that example XML converts to example JSON.""" validator.validate(minimal_json42) xsd42.assertValid(etree.XML(tostring(minimal_json42).encode('utf8')))
def test_empty_arrays(xsd42, minimal_json42, field_name): """Test proper behavior with empty lists for certain fields.""" minimal_json42[field_name] = [] validator.validate(minimal_json42) xsd42.assertValid(etree.XML(tostring(minimal_json42).encode('utf8')))
def validate_json(minimal_json, extra_json): """Validate specific property.""" data = {} data.update(minimal_json) data.update(extra_json) validator.validate(data)