diff Lib/test/test_array.py @ 42145:8eeaa9923901

Creating an array with a bytes object as initializer should treat the bytes as it treats a string. Not doing this broke re.compile() of big charsets.
author Guido van Rossum <guido@python.org>
date Tue, 03 Jul 2007 16:22:09 +0000
parents ebc87b94e6ea
children 27f0289b6835
line wrap: on
line diff
--- a/Lib/test/test_array.py	Tue Jul 03 15:39:16 2007 +0000
+++ b/Lib/test/test_array.py	Tue Jul 03 16:22:09 2007 +0000
@@ -700,6 +700,10 @@
         # SF bug #1486663 -- this used to erroneously raise a TypeError
         ArraySubclassWithKwargs('b', newarg=1)
 
+    def test_create_from_bytes(self):
+        a = array.array('H', b"1234")
+        self.assertEqual(len(a) * a.itemsize, 4)
+
 
 class StringTest(BaseTest):