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
