Kaydet (Commit) 47cb38cd authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Backported a test for lone surrogates support in io.StringIO.

üst 16252724
...@@ -588,6 +588,16 @@ class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, ...@@ -588,6 +588,16 @@ class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin,
UnsupportedOperation = pyio.UnsupportedOperation UnsupportedOperation = pyio.UnsupportedOperation
EOF = "" EOF = ""
def test_lone_surrogates(self):
# Issue #20424
surrogate = unichr(0xd800)
memio = self.ioclass(surrogate)
self.assertEqual(memio.read(), surrogate)
memio = self.ioclass()
memio.write(surrogate)
self.assertEqual(memio.getvalue(), surrogate)
class PyStringIOPickleTest(TextIOTestMixin, unittest.TestCase): class PyStringIOPickleTest(TextIOTestMixin, unittest.TestCase):
"""Test if pickle restores properly the internal state of StringIO. """Test if pickle restores properly the internal state of StringIO.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment