MCPcopy Index your code
hub / github.com/python/cpython / test_all_methods

Method test_all_methods

Lib/test/test_tabnanny.py:121–144  ·  view source on GitHub ↗

Asserting behaviour of `tabnanny.NannyNag` exception.

(self)

Source from the content-addressed store, hash-verified

119
120class TestNannyNag(TestCase):
121 def test_all_methods(self):
122 """Asserting behaviour of `tabnanny.NannyNag` exception."""
123 tests = [
124 (
125 tabnanny.NannyNag(0, "foo", "bar"),
126 {'lineno': 0, 'msg': 'foo', 'line': 'bar'}
127 ),
128 (
129 tabnanny.NannyNag(5, "testmsg", "testline"),
130 {'lineno': 5, 'msg': 'testmsg', 'line': 'testline'}
131 )
132 ]
133 for nanny, expected in tests:
134 line_number = nanny.get_lineno()
135 msg = nanny.get_msg()
136 line = nanny.get_line()
137 with self.subTest(
138 line_number=line_number, expected=expected['lineno']
139 ):
140 self.assertEqual(expected['lineno'], line_number)
141 with self.subTest(msg=msg, expected=expected['msg']):
142 self.assertEqual(expected['msg'], msg)
143 with self.subTest(line=line, expected=expected['line']):
144 self.assertEqual(expected['line'], line)
145
146
147class TestCheck(TestCase):

Callers

nothing calls this directly

Calls 5

get_msgMethod · 0.80
get_linenoMethod · 0.45
get_lineMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected