1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
From: Ole Streicher <olebole@debian.org>
Date: Tue, 20 Feb 2024 16:33:01 +0100
Subject: Don't require to raise an ValidationError on nested validations
This is no longer implemented in jsonschema >= 4.18
URL: https://github.com/asdf-format/asdf-standard/issues/424
Closes: #1064275
---
tests/test_asdf_schema.py | 8 ++++++--
tests/test_yaml_schema.py | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/test_asdf_schema.py b/tests/test_asdf_schema.py
index 8f7ad76..9b51d94 100644
--- a/tests/test_asdf_schema.py
+++ b/tests/test_asdf_schema.py
@@ -25,13 +25,17 @@ def test_nested_object_validation(path):
validator.validate(schema)
schema = {"$schema": metaschema["id"], "type": "object", "properties": {"foo": {"datatype": "banana"}}}
- with pytest.raises(ValidationError, match="'banana' is not valid"):
+ try:
validator.validate(schema)
+ except ValidationError:
+ pass
schema = {
"$schema": metaschema["id"],
"type": "array",
"items": {"type": "object", "properties": {"foo": {"ndim": "twelve"}}},
}
- with pytest.raises(ValidationError):
+ try:
validator.validate(schema)
+ except ValidationError:
+ pass
diff --git a/tests/test_yaml_schema.py b/tests/test_yaml_schema.py
index 46c30c3..a8e7427 100644
--- a/tests/test_yaml_schema.py
+++ b/tests/test_yaml_schema.py
@@ -25,13 +25,17 @@ def test_nested_object_validation(path):
validator.validate(schema)
schema = {"$schema": metaschema["id"], "type": "object", "properties": {"foo": {"flowStyle": "funky"}}}
- with pytest.raises(ValidationError, match="'funky' is not one of"):
+ try:
validator.validate(schema)
+ except ValidationError:
+ pass
schema = {
"$schema": metaschema["id"],
"type": "array",
"items": {"type": "object", "properties": {"foo": {"propertyOrder": "a,b,c,d"}}},
}
- with pytest.raises(ValidationError):
+ try:
validator.validate(schema)
+ except ValidationError:
+ pass
|