MCPcopy
hub / github.com/pydantic/pydantic / test_internal_error

Function test_internal_error

pydantic-core/tests/test_isinstance.py:42–53  ·  pydantic-core/tests/test_isinstance.py::test_internal_error
()

Source from the content-addressed store, hash-verified

40
41
42def test_internal_error():
43 v = SchemaValidator(
44 cs.model_schema(cls=int, schema=cs.model_fields_schema(fields={&class="cm">#x27;f': cs.model_field(schema=cs.int_schema())}))
45 )
46 with pytest.raises(AttributeError, match=class="st">"&class="cm">#x27;int' object has no attribute '__dict__'"):
47 v.validate_python({&class="cm">#x27;f': 123})
48
49 with pytest.raises(AttributeError, match=class="st">"&class="cm">#x27;int' object has no attribute '__dict__'"):
50 v.validate_json(&class="cm">#x27;{class="st">"f": 123}')
51
52 with pytest.raises(AttributeError, match=class="st">"&class="cm">#x27;int' object has no attribute '__dict__'"):
53 v.isinstance_python({&class="cm">#x27;f': 123})
54
55
56def test_omit(py_and_json: PyAndJson):

Callers

nothing calls this directly

Calls 5

model_schemaMethod · 0.80
model_fields_schemaMethod · 0.80
int_schemaMethod · 0.80
validate_pythonMethod · 0.45
validate_jsonMethod · 0.45

Tested by

no test coverage detected