MCPcopy
hub / github.com/pydantic/pydantic / test_isinstance_strict

Function test_isinstance_strict

pydantic-core/tests/test_isinstance.py:22–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21
22def test_isinstance_strict():
23 v = SchemaValidator(cs.int_schema(strict=True))
24 assert v.validate_python(123) == 123
25 assert v.isinstance_python(123) is True
26
27 with pytest.raises(ValidationError, match='Input should be a valid integer'):
28 v.validate_python('123')
29
30 assert v.isinstance_python('123') is False
31
32
33def test_isinstance_forbid_extra_fn_override():

Callers

nothing calls this directly

Calls 2

int_schemaMethod · 0.80
validate_pythonMethod · 0.45

Tested by

no test coverage detected