File tree Expand file tree Collapse file tree 2 files changed +0
-20
lines changed Expand file tree Collapse file tree 2 files changed +0
-20
lines changed Original file line number Diff line number Diff line change @@ -193,8 +193,6 @@ def __init__(
193
193
)
194
194
)
195
195
196
- __init__ .__pydantic_base_init__ = True # type: ignore
197
-
198
196
@classmethod
199
197
def settings_customise_sources (
200
198
cls ,
Original file line number Diff line number Diff line change 22
22
SecretStr ,
23
23
Tag ,
24
24
ValidationError ,
25
- ValidationInfo ,
26
- field_validator ,
27
25
)
28
26
from pydantic import (
29
27
dataclasses as pydantic_dataclasses ,
@@ -2774,22 +2772,6 @@ class Settings(BaseSettings):
2774
2772
assert s .model_dump () == {'nested' : {'foo' : ['one' , 'two' ]}}
2775
2773
2776
2774
2777
- def test_validation_context ():
2778
- class Settings (BaseSettings ):
2779
- foo : str
2780
-
2781
- @field_validator ('foo' )
2782
- @classmethod
2783
- def test_validator (cls , v : str , info : ValidationInfo ):
2784
- context = info .context
2785
- assert context == {'foo' : 'bar' }
2786
- return v
2787
-
2788
- s = Settings .model_validate ({'foo' : 'foo bar' }, context = {'foo' : 'bar' })
2789
- assert s .foo == 'foo bar'
2790
- assert s .model_dump () == {'foo' : 'foo bar' }
2791
-
2792
-
2793
2775
def test_nested_model_field_with_alias_choices (env ):
2794
2776
class NestedSettings (BaseModel ):
2795
2777
foo : List [str ] = Field (alias = AliasChoices ('fooalias' , 'foo-alias' ))
You can’t perform that action at this time.
0 commit comments