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

Method test_ps2

Lib/test/test_code_module.py:63–83  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

61 self.assertEqual(self.sysmod.ps1, 'custom1> ')
62
63 def test_ps2(self):
64 self.infunc.side_effect = [
65 "import code",
66 "code.sys.ps2",
67 EOFError('Finished')
68 ]
69 self.console.interact()
70 output = ''.join(''.join(call[1]) for call in self.stdout.method_calls)
71 self.assertIn('... ', output)
72 self.assertNotHasAttr(self.sysmod, 'ps2')
73
74 self.infunc.side_effect = [
75 "import code",
76 "code.sys.ps2",
77 EOFError('Finished')
78 ]
79 self.sysmod.ps2 = 'custom2> '
80 self.console.interact()
81 output = ''.join(''.join(call[1]) for call in self.stdout.method_calls)
82 self.assertIn('custom2> ', output)
83 self.assertEqual(self.sysmod.ps2, 'custom2> ')
84
85 def test_console_stderr(self):
86 self.infunc.side_effect = ["'antioch'", "", EOFError('Finished')]

Callers

nothing calls this directly

Calls 5

assertInMethod · 0.80
assertNotHasAttrMethod · 0.80
interactMethod · 0.45
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected