11"""
22Tests for hyperlink.test.common
33"""
4+ from typing import Any
45from unittest import TestCase
56from .common import HyperlinkTestCase
67
@@ -21,9 +22,11 @@ class TestHyperlink(TestCase):
2122 """Tests for HyperlinkTestCase"""
2223
2324 def setUp (self ):
25+ # type: () -> None
2426 self .hyperlink_test = HyperlinkTestCase ("run" )
2527
2628 def test_assertRaisesWithCallable (self ):
29+ # type: () -> None
2730 """HyperlinkTestCase.assertRaises does not raise an AssertionError
2831 when given a callable that, when called with the provided
2932 arguments, raises the expected exception.
@@ -32,6 +35,7 @@ def test_assertRaisesWithCallable(self):
3235 called_with = []
3336
3437 def raisesExpected (* args , ** kwargs ):
38+ # type: (Any, Any) -> None
3539 called_with .append ((args , kwargs ))
3640 raise _ExpectedException
3741
@@ -40,12 +44,14 @@ def raisesExpected(*args, **kwargs):
4044 self .assertEqual (called_with , [((1 ,), {"keyword" : True })])
4145
4246 def test_assertRaisesWithCallableUnexpectedException (self ):
47+ # type: () -> None
4348 """When given a callable that raises an unexpected exception,
4449 HyperlinkTestCase.assertRaises raises that exception.
4550
4651 """
4752
4853 def doesNotRaiseExpected (* args , ** kwargs ):
54+ # type: (Any, Any) -> None
4955 raise _UnexpectedException
5056
5157 try :
@@ -55,13 +61,15 @@ def doesNotRaiseExpected(*args, **kwargs):
5561 pass
5662
5763 def test_assertRaisesWithCallableDoesNotRaise (self ):
64+ # type: () -> None
5865 """HyperlinkTestCase.assertRaises raises an AssertionError when given
5966 a callable that, when called, does not raise any exception.
6067
6168 """
6269
6370 def doesNotRaise (* args , ** kwargs ):
64- return True
71+ # type: (Any, Any) -> None
72+ pass
6573
6674 try :
6775 self .hyperlink_test .assertRaises (_ExpectedException ,
@@ -70,6 +78,7 @@ def doesNotRaise(*args, **kwargs):
7078 pass
7179
7280 def test_assertRaisesContextManager (self ):
81+ # type: () -> None
7382 """HyperlinkTestCase.assertRaises does not raise an AssertionError
7483 when used as a context manager with a suite that raises the
7584 expected exception. The context manager stores the exception
@@ -79,9 +88,12 @@ def test_assertRaisesContextManager(self):
7988 with self .hyperlink_test .assertRaises (_ExpectedException ) as cm :
8089 raise _ExpectedException
8190
82- self .assertTrue (isinstance (cm .exception , _ExpectedException ))
91+ self .assertTrue ( # type: ignore[misc] unreachable
92+ isinstance (cm .exception , _ExpectedException )
93+ )
8394
8495 def test_assertRaisesContextManagerUnexpectedException (self ):
96+ # type: () -> None
8597 """When used as a context manager with a block that raises an
8698 unexpected exception, HyperlinkTestCase.assertRaises raises
8799 that unexpected exception.
@@ -94,6 +106,7 @@ def test_assertRaisesContextManagerUnexpectedException(self):
94106 pass
95107
96108 def test_assertRaisesContextManagerDoesNotRaise (self ):
109+ # type: () -> None
97110 """HyperlinkTestcase.assertRaises raises an AssertionError when used
98111 as a context manager with a block that does not raise any
99112 exception.
0 commit comments