MCPcopy
hub / github.com/pydantic/pydantic / isinstance_test

Method isinstance_test

pydantic-core/tests/conftest.py:90–99  ·  view source on GitHub ↗
(self, py_input, strict: bool | None = None, context: Any = None)

Source from the content-addressed store, hash-verified

88 return self.validator.validate_python(py_input, strict=strict, context=context, extra=extra)
89
90 def isinstance_test(self, py_input, strict: bool | None = None, context: Any = None):
91 if self.validator_type == 'json':
92 try:
93 self.validator.validate_json(json.dumps(py_input), strict=strict, context=context)
94 return True
95 except ValidationError:
96 return False
97 else:
98 assert self.validator_type == 'python', self.validator_type
99 return self.validator.isinstance_python(py_input, strict=strict, context=context)
100
101
102PyAndJson = type[PyAndJsonValidator]

Callers 8

test_int_strict_argumentFunction · 0.80
test_omitFunction · 0.80
test_isinstanceFunction · 0.80
test_date_jsonFunction · 0.80
test_date_pastFunction · 0.80
test_date_futureFunction · 0.80
test_boolFunction · 0.80
test_constrained_bytesFunction · 0.80

Calls 1

validate_jsonMethod · 0.45

Tested by

no test coverage detected