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

Method test_errprint

Lib/test/test_tabnanny.py:103–117  ·  view source on GitHub ↗

Asserting result of `tabnanny.errprint()` by giving sample inputs.

(self)

Source from the content-addressed store, hash-verified

101 """Testing `tabnanny.errprint()`."""
102
103 def test_errprint(self):
104 """Asserting result of `tabnanny.errprint()` by giving sample inputs."""
105 tests = [
106 (['first', 'second'], 'first second\n'),
107 (['first'], 'first\n'),
108 ([1, 2, 3], '1 2 3\n'),
109 ([], '\n')
110 ]
111
112 for args, expected in tests:
113 with self.subTest(arguments=args, expected=expected):
114 with self.assertRaises(SystemExit):
115 with captured_stderr() as stderr:
116 tabnanny.errprint(*args)
117 self.assertEqual(stderr.getvalue() , expected)
118
119
120class TestNannyNag(TestCase):

Callers

nothing calls this directly

Calls 5

captured_stderrFunction · 0.90
subTestMethod · 0.45
assertRaisesMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected