Skip to content

Commit

Permalink
Fix reference to .json()
Browse files Browse the repository at this point in the history
  • Loading branch information
David Montague committed Oct 23, 2019
1 parent 83590e4 commit 263f9af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def json(
"""
if skip_defaults is not None:
warnings.warn(
f'{self.__class__.__name__}.dict(): "skip_defaults" is deprecated and replaced by "exclude_unset"',
f'{self.__class__.__name__}.json(): "skip_defaults" is deprecated and replaced by "exclude_unset"',
DeprecationWarning,
)
exclude_unset = skip_defaults
Expand Down
2 changes: 2 additions & 0 deletions tests/test_edge_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ class Model(BaseModel):
assert m.dict(skip_defaults=True)
with pytest.warns(DeprecationWarning, match=match):
assert m.dict(skip_defaults=False)

match = r'Model.json\(\): "skip_defaults" is deprecated and replaced by "exclude_unset"'
with pytest.warns(DeprecationWarning, match=match):
assert m.json(skip_defaults=True)
with pytest.warns(DeprecationWarning, match=match):
Expand Down

0 comments on commit 263f9af

Please sign in to comment.