@@ -127,16 +127,14 @@ def test_ctrl_w_display_preserves_prompt(self):
127127 output = self .check_raw_input ('hello world\x17 \n ' , 'hello ' )
128128 # The final visible state should be "Password: ******"
129129 # Verify prompt is rewritten during refresh, not overwritten by stars
130- self .assertTrue (output .endswith ('Password: ******' ),
131- f'Prompt corrupted in display: { output !r} ' )
130+ self .assertEndsWith (output , 'Password: ******' )
132131
133132 def test_ctrl_a_insert_display_preserves_prompt (self ):
134133 # Reproducer from gh-138577: type "abc", Ctrl+A, type "x"
135134 # Display must show "Password: ****" not "****word: ***"
136135 output = self .check_raw_input ('abc\x01 x\n ' , 'xabc' )
137136 # The final visible state should be "Password: ****"
138- self .assertTrue (output .endswith ('Password: ****\x08 \x08 \x08 ' ),
139- f'Prompt corrupted in display: { output !r} ' )
137+ self .assertEndsWith (output , 'Password: ****\x08 \x08 \x08 ' )
140138
141139 def test_lnext_ctrl_v_with_echo_char (self ):
142140 # Ctrl+V (LNEXT) should insert the next character literally
@@ -156,10 +154,8 @@ def test_ctrl_k_kill_forward_with_echo_char(self):
156154
157155 def test_ctrl_c_interrupt_with_echo_char (self ):
158156 # Ctrl+C should raise KeyboardInterrupt
159- mock_input = StringIO ('test\x03 more' )
160- mock_output = StringIO ()
161157 with self .assertRaises (KeyboardInterrupt ):
162- getpass . _raw_input ( 'Password: ' , mock_output , mock_input , '* ' )
158+ self . check_raw_input ( 'test \x03 more ' , ' ' )
163159
164160 def test_ctrl_d_eof_with_echo_char (self ):
165161 # Ctrl+D twice should cause EOF
0 commit comments