Skip to content

Commit 8e85a60

Browse files
committed
revise test
1 parent 4a8aa3e commit 8e85a60

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/validators/test_model_fields.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,12 @@ def test_deprecation_msg():
17921792
'b': {
17931793
'type': 'model-field',
17941794
'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2},
1795-
'deprecation_msg': 'hi',
1795+
'deprecation_msg': 'foo',
1796+
},
1797+
'c': {
1798+
'type': 'model-field',
1799+
'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2},
1800+
'deprecation_msg': 'bar',
17961801
},
17971802
},
17981803
}
@@ -1802,5 +1807,9 @@ def test_deprecation_msg():
18021807
v.validate_python({'a': 1})
18031808

18041809
# validating the deprecated field: raise warning
1805-
with pytest.warns(DeprecationWarning, match='hi'):
1806-
v.validate_python({'a': 1, 'b': 1})
1810+
# ensure that we get two warnings
1811+
with pytest.warns(DeprecationWarning) as w:
1812+
v.validate_python({'a': 1, 'b': 1, 'c': 1})
1813+
assert len(w) == 2
1814+
assert str(w[0].message) == 'foo'
1815+
assert str(w[1].message) == 'bar'

0 commit comments

Comments
 (0)