Skip to content

Commit 6485375

Browse files
bkjohpicnixz
andauthored
test every non-printable ascii byte
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent 2203e03 commit 6485375

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_getpass.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,11 @@ def test_rejects_multi_character_strings(self, echo_char):
224224
def test_rejects_non_ascii(self, echo_char):
225225
self.assertRaises(ValueError, getpass.getpass, echo_char=echo_char)
226226

227-
@support.subTests('echo_char', ["\n", "\t", "\r", "\x00", "\x7f", "\x07"])
228-
def test_rejects_control_characters(self, echo_char):
227+
@support.subTests('echo_char', [
228+
ch for ch in map(chr, range(0, 128))
229+
if not ch.isprintable()
230+
])
231+
def test_rejects_non_printable_characters(self, echo_char):
229232
self.assertRaises(ValueError, getpass.getpass, echo_char=echo_char)
230233

231234
# TypeError Rejection(s)

0 commit comments

Comments
 (0)