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

Method test_file

Lib/test/test_symtable.py:643–658  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

641 maxDiff = None
642
643 def test_file(self):
644 filename = os_helper.TESTFN
645 self.addCleanup(os_helper.unlink, filename)
646 with open(filename, 'w') as f:
647 f.write(TEST_CODE)
648 with support.captured_stdout() as stdout:
649 symtable.main([filename])
650 out = stdout.getvalue()
651 self.assertIn('\n\n', out)
652 self.assertNotIn('\n\n\n', out)
653 lines = out.splitlines()
654 self.assertIn(f"symbol table for module from file {filename!r}:", lines)
655 self.assertIn(" local symbol 'glob': def_local", lines)
656 self.assertIn(" global_implicit symbol 'glob': use", lines)
657 self.assertIn(" local symbol 'spam': def_local", lines)
658 self.assertIn(" symbol table for function 'spam':", lines)
659
660 def test_stdin(self):
661 with support.captured_stdin() as stdin:

Callers

nothing calls this directly

Calls 8

addCleanupMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
openFunction · 0.50
writeMethod · 0.45
mainMethod · 0.45
getvalueMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected