Skip to content

Commit

Permalink
test: use pytest.raises
Browse files Browse the repository at this point in the history
I learned a new thing about pytest today
  • Loading branch information
skeggse authored Jun 20, 2023
1 parent 108391f commit b3d2bef
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tests/test_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ def test_nested_list_of_dataclasses(self):
DataClassXs([DataClassX(0), DataClassX(1)]))

def test_nested_mapping_of_dataclasses(self):
err = None
try:
with pytest.raises(TypeError, match="positional arguments"):
DataClassMappingBadDecode.from_dict(dict(map=dict(test=dict(id="irrelevant"))))
except TypeError as e:
if "positional arguments" not in e.args[0]:
raise
err = e
assert isinstance(err, TypeError)


class TestNested:
Expand Down

0 comments on commit b3d2bef

Please sign in to comment.