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

Method test_ps1

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

Source from the content-addressed store, hash-verified

39 self.mock_sys()
40
41 def test_ps1(self):
42 self.infunc.side_effect = [
43 "import code",
44 "code.sys.ps1",
45 EOFError('Finished')
46 ]
47 self.console.interact()
48 output = ''.join(''.join(call[1]) for call in self.stdout.method_calls)
49 self.assertIn('>>> ', output)
50 self.assertNotHasAttr(self.sysmod, 'ps1')
51
52 self.infunc.side_effect = [
53 "import code",
54 "code.sys.ps1",
55 EOFError('Finished')
56 ]
57 self.sysmod.ps1 = 'custom1> '
58 self.console.interact()
59 output = ''.join(''.join(call[1]) for call in self.stdout.method_calls)
60 self.assertIn('custom1> ', output)
61 self.assertEqual(self.sysmod.ps1, 'custom1> ')
62
63 def test_ps2(self):
64 self.infunc.side_effect = [

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