MCPcopy
hub / github.com/pydantic/pydantic / test_too_long

Function test_too_long

pydantic-core/tests/validators/test_int.py:427–451  ·  view source on GitHub ↗
(pydantic_version)

Source from the content-addressed store, hash-verified

425
426
427def test_too_long(pydantic_version):
428 v = SchemaValidator(cs.int_schema())
429
430 with pytest.raises(ValidationError) as exc_info:
431 v.validate_python('1' * 4301)
432
433 assert exc_info.value.errors(include_url=False) == [
434 {
435 'type': 'int_parsing_size',
436 'loc': (),
437 'msg': 'Unable to parse input string as an integer, exceeded maximum size',
438 'input': '1' * 4301,
439 }
440 ]
441 # insert_assert(repr(exc_info.value))
442 assert repr(exc_info.value) == (
443 '1 validation error for int\n'
444 ' Unable to parse input string as an integer, exceeded maximum size '
445 "[type=int_parsing_size, input_value='111111111111111111111111...11111111111111111111111', input_type=str]"
446 + (
447 f'\n For further information visit https://errors.pydantic.dev/{pydantic_version}/v/int_parsing_size'
448 if os.environ.get('PYDANTIC_ERRORS_INCLUDE_URL', '1') != 'false'
449 else ''
450 )
451 )
452
453
454def test_long_python():

Callers

nothing calls this directly

Calls 4

int_schemaMethod · 0.80
validate_pythonMethod · 0.45
errorsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected