@@ -1597,6 +1597,11 @@ def _wrap_validator(cls, v, validator, info):
1597
1597
init_test_cases = [
1598
1598
({'a' : 'hello' , 'b' : 'bye' }, 'ignore' , {'a' : 'hello' , 'b' : 'HELLO' }),
1599
1599
({'a' : 'hello' }, 'ignore' , {'a' : 'hello' , 'b' : 'HELLO' }),
1600
+ # note, for the case below, we don't actually support this case in Pydantic
1601
+ # it's disallowed in Pydantic to have a model with extra='allow' and a field
1602
+ # with init=False, so this case isn't really possible at the momment
1603
+ # however, no conflict arises here because we don't pass in the value for b
1604
+ # to __init__
1600
1605
({'a' : 'hello' }, 'allow' , {'a' : 'hello' , 'b' : 'HELLO' }),
1601
1606
(
1602
1607
{'a' : 'hello' , 'b' : 'bye' },
@@ -1621,6 +1626,11 @@ def _wrap_validator(cls, v, validator, info):
1621
1626
'input_value,extra_behavior,expected' ,
1622
1627
[
1623
1628
* init_test_cases ,
1629
+ # special case - when init=False, extra='allow', and the value is provided
1630
+ # currently, it's disallowed in Pydantic to have a model with extra='allow'
1631
+ # and a field with init=False, so this case isn't really possible at the momment
1632
+ # TODO: open to changing this behavior, and changes won't be significantly breaking
1633
+ # because we currently don't support this case
1624
1634
({'a' : 'hello' , 'b' : 'bye' }, 'allow' , {'a' : 'hello' , 'b' : 'HELLO' }),
1625
1635
],
1626
1636
)
0 commit comments