Skip to content

Commit

Permalink
fixup! tests: harden testing/test_recwarn.py::TestWarningsRecorderChe…
Browse files Browse the repository at this point in the history
…cker::test_typechecking (regressed in 2dca68)
  • Loading branch information
blueyed committed Oct 27, 2020
1 parent 7cba583 commit b9c3dee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions testing/test_recwarn.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ def test_warn_stacklevel(self) -> None:
def test_typechecking(self) -> None:
msg = "exceptions must be derived from Warning, not {}"
with pytest.raises(TypeError, match=msg.format("int")):
WarningsChecker(5)
WarningsChecker(5) # type: ignore[arg-type]
with pytest.raises(TypeError, match=msg.format("str")):
WarningsChecker(("hi", RuntimeWarning))
WarningsChecker(("hi", RuntimeWarning)) # type: ignore[arg-type]
with pytest.raises(TypeError, match=msg.format("list")):
WarningsChecker([DeprecationWarning, RuntimeWarning])
WarningsChecker([DeprecationWarning, RuntimeWarning]) # type: ignore[arg-type]

def test_nested_tuples(self) -> None:
wc1 = WarningsChecker((DeprecationWarning, RuntimeWarning))
wc2 = WarningsChecker(((DeprecationWarning,), (RuntimeWarning,)))
wc2 = WarningsChecker(((DeprecationWarning,), (RuntimeWarning,))) # type: ignore[arg-type]
assert wc1.expected_warning == (DeprecationWarning, RuntimeWarning)
assert wc1.expected_warning == wc2.expected_warning

Expand Down

0 comments on commit b9c3dee

Please sign in to comment.