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

Method test_with_errored_codes_samples

Lib/test/test_tabnanny.py:275–290  ·  view source on GitHub ↗

A python source code with whitespace related sampled problems.

(self)

Source from the content-addressed store, hash-verified

273 self.assertFalse(MockNannyNag.called)
274
275 def test_with_errored_codes_samples(self):
276 """A python source code with whitespace related sampled problems."""
277
278 # "tab_space_errored_1": executes block under type == tokenize.INDENT
279 # at `tabnanny.process_tokens()`.
280 # "tab space_errored_2": executes block under
281 # `check_equal and type not in JUNK` condition at
282 # `tabnanny.process_tokens()`.
283
284 for key in ["tab_space_errored_1", "tab_space_errored_2"]:
285 with self.subTest(key=key):
286 with TemporaryPyFile(SOURCE_CODES[key]) as file_path:
287 with open(file_path) as f:
288 tokens = tokenize.generate_tokens(f.readline)
289 with self.assertRaises(tabnanny.NannyNag):
290 tabnanny.process_tokens(tokens)
291
292
293class TestCommandLine(TestCase):

Callers

nothing calls this directly

Calls 4

TemporaryPyFileClass · 0.85
openFunction · 0.50
subTestMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected