mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Remove have_unicode checks and merge those tests into the
normal code (or drop them if they only repeat previous tests).
This commit is contained in:
parent
02427050c1
commit
1f5947b30a
7 changed files with 56 additions and 195 deletions
|
@ -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
|
||||
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')
|
||||
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')
|
||||
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')")
|
||||
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)
|
||||
self.assertRaises(TypeError, a.fromunicode)
|
||||
|
||||
tests.append(UnicodeTest)
|
||||
tests.append(UnicodeTest)
|
||||
|
||||
class NumberTest(BaseTest):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue