summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-01-29 09:49:13 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-01-29 09:49:13 (GMT)
commit47cb38cdcc3e16d77ecc9808ad669181ce54b246 (patch)
tree5b358ae6b4e51a19f653c7e0815b12b91343807f
parent162527244412e8bf51f40aaa6c3d9721326c785a (diff)
downloadcpython-47cb38cdcc3e16d77ecc9808ad669181ce54b246.zip
cpython-47cb38cdcc3e16d77ecc9808ad669181ce54b246.tar.gz
cpython-47cb38cdcc3e16d77ecc9808ad669181ce54b246.tar.bz2
Backported a test for lone surrogates support in io.StringIO.
-rw-r--r--Lib/test/test_memoryio.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index c3d559d..f6aef4e 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -588,6 +588,16 @@ class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin,
UnsupportedOperation = pyio.UnsupportedOperation
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):
"""Test if pickle restores properly the internal state of StringIO.