Browse Source

Prepare for pydantic 2.12.0

`tests/test_multi_body_errors.py::test_openapi_schema` failed with
pydantic 2.12.0a1 due to
https://github.com/pydantic/pydantic/pull/11987.  Since we're testing
the exact contents of the JSON schema, the easiest fix seems to be to
add version-dependent handling for this.
pull/14036/head
Colin Watson 11 months ago
parent
commit
5386c5d651
  1. 10
      tests/test_multi_body_errors.py

10
tests/test_multi_body_errors.py

@ -185,7 +185,15 @@ def test_openapi_schema():
"title": "Age",
"anyOf": [
{"exclusiveMinimum": 0.0, "type": "number"},
{"type": "string"},
IsOneOf(
# pydantic < 2.12.0a1
{"type": "string"},
# pydantic >= 2.12.0a1
{
"type": "string",
"pattern": r"^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$",
},
),
],
}
)

Loading…
Cancel
Save