MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_errprint

Method test_errprint

Lib/test/test_tabnanny.py:104–118  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected