diff options
Diffstat (limited to 'Lib/test/test_memoryio.py')
-rw-r--r-- | Lib/test/test_memoryio.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py index 0b25283..670dab9 100644 --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -140,6 +140,7 @@ class MemoryTestMixin: self.assertEqual(memio.getvalue(), buf * 2) memio.__init__(buf) self.assertEqual(memio.getvalue(), buf) + self.assertRaises(TypeError, memio.__init__, []) def test_read(self): buf = self.buftype("1234567890") @@ -530,6 +531,13 @@ class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): memio = self.ioclass("a\r\nb\r\n", newline=None) self.assertEqual(memio.read(5), "a\nb\n") + def test_newline_argument(self): + self.assertRaises(TypeError, self.ioclass, newline=b"\n") + self.assertRaises(ValueError, self.ioclass, newline="error") + # These should not raise an error + for newline in (None, "", "\n", "\r", "\r\n"): + self.ioclass(newline=newline) + class CBytesIOTest(PyBytesIOTest): ioclass = io.BytesIO |