File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ class PydanticModel(pydantic.BaseModel):
8181 _hash_func_mapping : t .ClassVar [t .Dict [t .Type [t .Any ], t .Callable [[t .Any ], int ]]] = {}
8282
8383 def dict (self , ** kwargs : t .Any ) -> t .Dict [str , t .Any ]:
84- return super ().model_dump (** DEFAULT_ARGS , ** kwargs ) # type: ignore
84+ kwargs = {** DEFAULT_ARGS , ** kwargs }
85+ return super ().model_dump (** kwargs ) # type: ignore
8586
8687 def json (
8788 self ,
Original file line number Diff line number Diff line change @@ -55,3 +55,10 @@ def private(self) -> str:
5555 model_2_b = TestModel2 (name = "a" )
5656 assert hash (model_2_a ) == hash (model_2_b )
5757 assert hash (model_a ) != hash (model_2_a )
58+
59+
60+ def test_pydantic_dict_default_args_override () -> None :
61+ class TestModel (PydanticModel ):
62+ name : str
63+
64+ assert TestModel (name = "foo" ).dict (by_alias = True )
You can’t perform that action at this time.
0 commit comments