mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
don't accept bytes in FileIO.write #7785
This commit is contained in:
parent
d8aef76f6e
commit
255058fae3
3 changed files with 7 additions and 2 deletions
|
@ -78,6 +78,9 @@ class AutoFileTests(unittest.TestCase):
|
|||
self.assertEqual(self.f.readline(None), b"hi\n")
|
||||
self.assertEqual(self.f.readlines(None), [b"bye\n", b"abc"])
|
||||
|
||||
def test_reject(self):
|
||||
self.assertRaises(TypeError, self.f.write, "Hello!")
|
||||
|
||||
def testRepr(self):
|
||||
self.assertEquals(repr(self.f), "<_io.FileIO name=%r mode=%r>"
|
||||
% (self.f.name, self.f.mode))
|
||||
|
@ -168,7 +171,7 @@ class AutoFileTests(unittest.TestCase):
|
|||
|
||||
@ClosedFDRaises
|
||||
def testErrnoOnClosedWrite(self, f):
|
||||
f.write('a')
|
||||
f.write(b'a')
|
||||
|
||||
@ClosedFDRaises
|
||||
def testErrnoOnClosedSeek(self, f):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue