summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-22 16:52:54 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-22 16:52:54 (GMT)
commit1f5947b30a870008ebd2367b2f4f9a5897f657c9 (patch)
tree2a881cb9b9dcfeaa1e96dc0905f0a9b56993caca /Lib/test/test_array.py
parent02427050c187ba54649c7ad16b35370c31a0b238 (diff)
downloadcpython-1f5947b30a870008ebd2367b2f4f9a5897f657c9.zip
cpython-1f5947b30a870008ebd2367b2f4f9a5897f657c9.tar.gz
cpython-1f5947b30a870008ebd2367b2f4f9a5897f657c9.tar.bz2
Remove have_unicode checks and merge those tests into the
normal code (or drop them if they only repeat previous tests).
Diffstat (limited to 'Lib/test/test_array.py')
-rwxr-xr-xLib/test/test_array.py57
1 files changed, 28 insertions, 29 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 937aa7e..07a796f 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -752,35 +752,34 @@ class CharacterTest(StringTest):
tests.append(CharacterTest)
-if test_support.have_unicode:
- class UnicodeTest(StringTest):
- typecode = 'u'
- example = '\x01\u263a\x00\ufeff'
- smallerexample = '\x01\u263a\x00\ufefe'
- biggerexample = '\x01\u263a\x01\ufeff'
- outside = str('\x33')
- minitemsize = 2
-
- def test_unicode(self):
- self.assertRaises(TypeError, array.array, 'b', 'foo')
-
- a = array.array('u', '\xa0\xc2\u1234')
- a.fromunicode(' ')
- a.fromunicode('')
- a.fromunicode('')
- a.fromunicode('\x11abc\xff\u1234')
- s = a.tounicode()
- self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234')
-
- s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234'
- a = array.array('u', s)
- self.assertEqual(
- repr(a),
- "array('u', '\\x00=\"\\'a\\\\b\\x80\\xff\\x00\\x01\\u1234')")
-
- self.assertRaises(TypeError, a.fromunicode)
-
- tests.append(UnicodeTest)
+class UnicodeTest(StringTest):
+ typecode = 'u'
+ example = '\x01\u263a\x00\ufeff'
+ smallerexample = '\x01\u263a\x00\ufefe'
+ biggerexample = '\x01\u263a\x01\ufeff'
+ outside = str('\x33')
+ minitemsize = 2
+
+ def test_unicode(self):
+ self.assertRaises(TypeError, array.array, 'b', 'foo')
+
+ a = array.array('u', '\xa0\xc2\u1234')
+ a.fromunicode(' ')
+ a.fromunicode('')
+ a.fromunicode('')
+ a.fromunicode('\x11abc\xff\u1234')
+ s = a.tounicode()
+ self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234')
+
+ s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234'
+ a = array.array('u', s)
+ self.assertEqual(
+ repr(a),
+ "array('u', '\\x00=\"\\'a\\\\b\\x80\\xff\\x00\\x01\\u1234')")
+
+ self.assertRaises(TypeError, a.fromunicode)
+
+tests.append(UnicodeTest)
class NumberTest(BaseTest):