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

Method verify_tabnanny_check

Lib/test/test_tabnanny.py:155–166  ·  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

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