mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
This commit is contained in:
parent
4a4b679515
commit
d8a1447c99
14 changed files with 41 additions and 39 deletions
|
@ -363,8 +363,8 @@ class IOTest(unittest.TestCase):
|
|||
|
||||
def test_open_handles_NUL_chars(self):
|
||||
fn_with_NUL = 'foo\0bar'
|
||||
self.assertRaises(TypeError, self.open, fn_with_NUL, 'w')
|
||||
self.assertRaises(TypeError, self.open, bytes(fn_with_NUL, 'ascii'), 'w')
|
||||
self.assertRaises(ValueError, self.open, fn_with_NUL, 'w')
|
||||
self.assertRaises(ValueError, self.open, bytes(fn_with_NUL, 'ascii'), 'w')
|
||||
|
||||
def test_raw_file_io(self):
|
||||
with self.open(support.TESTFN, "wb", buffering=0) as f:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue