@@ -39,19 +39,47 @@ def setUp(self):
3939 self .mock_sys ()
4040
4141 def test_ps1 (self ):
42- self .infunc .side_effect = EOFError ('Finished' )
42+ self .infunc .side_effect = [
43+ "import code" ,
44+ "code.sys.ps1" ,
45+ EOFError ('Finished' )
46+ ]
4347 self .console .interact ()
44- self .assertEqual (self .sysmod .ps1 , '>>> ' )
48+ output = '' .join ('' .join (call [1 ]) for call in self .stdout .method_calls )
49+ self .assertIn ('>>> ' , output )
50+ self .assertFalse (hasattr (self .sysmod , 'ps1' ))
51+
52+ self .infunc .side_effect = [
53+ "import code" ,
54+ "code.sys.ps1" ,
55+ EOFError ('Finished' )
56+ ]
4557 self .sysmod .ps1 = 'custom1> '
4658 self .console .interact ()
59+ output = '' .join ('' .join (call [1 ]) for call in self .stdout .method_calls )
60+ self .assertIn ('custom1> ' , output )
4761 self .assertEqual (self .sysmod .ps1 , 'custom1> ' )
4862
4963 def test_ps2 (self ):
50- self .infunc .side_effect = EOFError ('Finished' )
64+ self .infunc .side_effect = [
65+ "import code" ,
66+ "code.sys.ps2" ,
67+ EOFError ('Finished' )
68+ ]
5169 self .console .interact ()
52- self .assertEqual (self .sysmod .ps2 , '... ' )
70+ output = '' .join ('' .join (call [1 ]) for call in self .stdout .method_calls )
71+ self .assertIn ('... ' , output )
72+ self .assertFalse (hasattr (self .sysmod , 'ps2' ))
73+
74+ self .infunc .side_effect = [
75+ "import code" ,
76+ "code.sys.ps2" ,
77+ EOFError ('Finished' )
78+ ]
5379 self .sysmod .ps2 = 'custom2> '
5480 self .console .interact ()
81+ output = '' .join ('' .join (call [1 ]) for call in self .stdout .method_calls )
82+ self .assertIn ('custom2> ' , output )
5583 self .assertEqual (self .sysmod .ps2 , 'custom2> ' )
5684
5785 def test_console_stderr (self ):
0 commit comments