Skip to content

Commit d373e11

Browse files
committed
revert change
1 parent 82ca301 commit d373e11

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

tests/validators/test_typed_dict.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99
from dirty_equals import FunctionCheck, HasRepr, IsStr
1010

11-
from pydantic_core import CoreConfig, SchemaError, SchemaValidator, ValidationError, core_schema
11+
from pydantic_core import CoreConfig, SchemaError, SchemaValidator, ValidationError
1212

1313
from ..conftest import Err, PyAndJson
1414

@@ -1436,26 +1436,3 @@ def test_frozen_field():
14361436
assert exc_info.value.errors() == [
14371437
{'type': 'frozen', 'loc': ('is_developer',), 'msg': 'Field is frozen', 'input': False}
14381438
]
1439-
1440-
1441-
def test_field_before_function():
1442-
"""A field cannot be required and have a default value"""
1443-
1444-
def f(v: str, info: core_schema.ModelFieldValidationInfo) -> str:
1445-
assert v == 'hello'
1446-
assert info.data == {'x': 'hello'}
1447-
assert info.field_name == 'x'
1448-
return 'hello world!'
1449-
1450-
v = SchemaValidator(
1451-
core_schema.typed_dict_schema(
1452-
{
1453-
'a': core_schema.typed_dict_field(core_schema.int_schema()),
1454-
'c': core_schema.typed_dict_field(
1455-
core_schema.field_before_validation_function(f, core_schema.str_schema())
1456-
),
1457-
}
1458-
)
1459-
)
1460-
1461-
assert v.validate_python({'a': 1, 'c': 'hello'}) == {'a': 1, 'c': 'hello world!'}

0 commit comments

Comments
 (0)