From fef528f3bcc290b44290df8392801b247c759735 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 31 Jul 2024 16:51:37 -0700 Subject: [PATCH] make test order insensitive --- tests/test_ndarray.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/test_ndarray.py b/tests/test_ndarray.py index 203a4f2..7b512ef 100644 --- a/tests/test_ndarray.py +++ b/tests/test_ndarray.py @@ -64,15 +64,12 @@ class Model(BaseModel): array: NDArray[Shape["2 x, * y"], (np.uint8, np.uint16)] schema = Model.model_json_schema() - assert schema["properties"]["array"]["items"] == { - "items": { - "anyOf": [ - {"maximum": 255, "minimum": 0, "type": "integer"}, - {"maximum": 65535, "minimum": 0, "type": "integer"}, - ] - }, - "type": "array", - } + assert "anyOf" in schema["properties"]["array"]["items"]["items"] + conditions = schema["properties"]["array"]["items"]["items"]["anyOf"] + + assert all([i["type"] == "integer" for i in conditions]) + assert sorted([i["maximum"] for i in conditions]) == [255, 65535] + assert all([i["minimum"] == 0 for i in conditions]) def test_schema_number():