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

Method verify_tabnanny_check

Lib/test/test_tabnanny.py:154–165  ·  view source on GitHub ↗

Common verification for tabnanny.check(). Use this method to assert expected values of `stdout` and `stderr` after running tabnanny.check() on given `dir` or `file` path. Because tabnanny.check() captures exceptions and writes to `stdout` and `stderr`, asserting stan

(self, dir_or_file, out="", err="")

Source from the content-addressed store, hash-verified

152 tabnanny.verbose = 0 # Forcefully deactivating verbose mode.
153
154 def verify_tabnanny_check(self, dir_or_file, out="", err=""):
155 """Common verification for tabnanny.check().
156
157 Use this method to assert expected values of `stdout` and `stderr` after
158 running tabnanny.check() on given `dir` or `file` path. Because
159 tabnanny.check() captures exceptions and writes to `stdout` and
160 `stderr`, asserting standard outputs is the only way.
161 """
162 with captured_stdout() as stdout, captured_stderr() as stderr:
163 tabnanny.check(dir_or_file)
164 self.assertEqual(stdout.getvalue(), out)
165 self.assertEqual(stderr.getvalue(), err)
166
167 def test_correct_file(self):
168 """A python source code file without any errors."""

Calls 5

captured_stdoutFunction · 0.90
captured_stderrFunction · 0.90
checkMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected