MCPcopy
hub / github.com/pydantic/pydantic / test_bytes

Function test_bytes

pydantic-core/tests/test_json.py:58–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56
57
58def test_bytes():
59 s = SchemaValidator(core_schema.bytes_schema())
60 assert s.validate_json('"foobar"') == b'foobar'
61 with pytest.raises(ValidationError, match=r'Input should be a valid bytes \[type=bytes_type,'):
62 s.validate_json('false')
63 with pytest.raises(ValidationError, match=r'Input should be a valid bytes \[type=bytes_type,'):
64 s.validate_json('123')
65
66
67# A number well outside of i64 range

Callers

nothing calls this directly

Calls 2

bytes_schemaMethod · 0.80
validate_jsonMethod · 0.45

Tested by

no test coverage detected