# HG changeset patch # User Franz Glasner # Date 1689837631 -7200 # Node ID 0e7acd426e3ab24d9897213a0a62ada7aa487cc0 # Parent d2b43423fa4c5b9da1f76520bfed4f8e594e8e0f An extra unittest to handle schema conditionals after processing schema references diff -r d2b43423fa4c -r 0e7acd426e3a tests/test_schema.py --- a/tests/test_schema.py Thu Jul 20 02:04:17 2023 +0200 +++ b/tests/test_schema.py Thu Jul 20 09:20:31 2023 +0200 @@ -1125,6 +1125,27 @@ self.assertIsNot(r, schema) self.assertEqual("string", r["$type"]) + def test_anyOf_true_indirectly_by_ref(self): + schema = data_schema._Schema( + None, + True, + {"$ref": "schema:$self#/_lib/s1", + "_lib": { + "s1": { + "cond": [ + {"when": {"any-of": [ + False, + {"ref-not-exists": '#foo3-non'}, + {"ref-false": '#foo2'}]}, + "then": {"$type": "string"}}, + {"when": True, + "then": {"$type": None}} + ]}}}) + r = data_schema.process_schema_conditionals(schema, self._ctx) + r = data_schema.process_schema_references(r, self._ctx, check_single_ref_key=False) + self.assertIsNot(r, schema) + self.assertEqual("string", r["$type"]) + def test_anyOf_false(self): schema = data_schema._Schema( None, True, {"cond": [