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="")
| 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.""" |
no test coverage detected