diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-13 02:28:18 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-13 02:28:18 (GMT) |
commit | a87b383ac132da0116dac2d8bd8bb3c3359b54b3 (patch) | |
tree | a7dcca741b519512903318409884f1e2ddba0b6b /Lib/test/test_unicode.py | |
parent | 0f4dd9a8e565be5c6ce4adeb2429071d06b2d5db (diff) | |
download | cpython-a87b383ac132da0116dac2d8bd8bb3c3359b54b3.zip cpython-a87b383ac132da0116dac2d8bd8bb3c3359b54b3.tar.gz cpython-a87b383ac132da0116dac2d8bd8bb3c3359b54b3.tar.bz2 |
Reenable test_ucs4 and remove some duplicated lines.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index aeac724..0ada5cc 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -62,7 +62,7 @@ class UnicodeTest(string_tests.CommonTest, self.assertRaises(SyntaxError, eval, '\'\\Uffffffff\'') self.assertRaises(SyntaxError, eval, '\'\\U%08x\'' % 0x110000) # raw strings should not have unicode escapes - self.assertNotEquals(r"\u0020", " ") + self.assertNotEqual(r"\u0020", " ") def test_ascii(self): if not sys.platform.startswith('java'): @@ -286,13 +286,7 @@ class UnicodeTest(string_tests.CommonTest, def test_comparison(self): # Comparisons: self.assertEqual('abc', 'abc') - self.assertEqual('abc', 'abc') - self.assertEqual('abc', 'abc') - self.assertTrue('abcd' > 'abc') self.assertTrue('abcd' > 'abc') - self.assertTrue('abcd' > 'abc') - self.assertTrue('abc' < 'abcd') - self.assertTrue('abc' < 'abcd') self.assertTrue('abc' < 'abcd') if 0: @@ -652,8 +646,6 @@ class UnicodeTest(string_tests.CommonTest, self.assertRaises(IndexError, '{1}'.format, 'abc') self.assertRaises(KeyError, '{x}'.format) self.assertRaises(ValueError, "}{".format) - self.assertRaises(ValueError, "{".format) - self.assertRaises(ValueError, "}".format) self.assertRaises(ValueError, "abc{0:{}".format) self.assertRaises(ValueError, "{0".format) self.assertRaises(IndexError, "{0.}".format) @@ -1265,21 +1257,20 @@ class UnicodeTest(string_tests.CommonTest, y = x.encode("raw-unicode-escape").decode("raw-unicode-escape") self.assertEqual(x, y) - # FIXME - #y = r'\U00100000' - #x = y.encode("raw-unicode-escape").decode("raw-unicode-escape") - #self.assertEqual(x, y) - #y = r'\U00010000' - #x = y.encode("raw-unicode-escape").decode("raw-unicode-escape") - #self.assertEqual(x, y) - - #try: - # '\U11111111'.decode("raw-unicode-escape") - #except UnicodeDecodeError as e: - # self.assertEqual(e.start, 0) - # self.assertEqual(e.end, 10) - #else: - # self.fail("Should have raised UnicodeDecodeError") + y = br'\U00100000' + x = y.decode("raw-unicode-escape").encode("raw-unicode-escape") + self.assertEqual(x, y) + y = br'\U00010000' + x = y.decode("raw-unicode-escape").encode("raw-unicode-escape") + self.assertEqual(x, y) + + try: + br'\U11111111'.decode("raw-unicode-escape") + except UnicodeDecodeError as e: + self.assertEqual(e.start, 0) + self.assertEqual(e.end, 10) + else: + self.fail("Should have raised UnicodeDecodeError") def test_conversion(self): # Make sure __unicode__() works properly @@ -1382,8 +1373,8 @@ class UnicodeTest(string_tests.CommonTest, def __str__(self): return '__str__ overridden' s = S('xxx') - self.assertEquals("%s" % s, '__str__ overridden') - self.assertEquals("{}".format(s), '__str__ overridden') + self.assertEqual("%s" % s, '__str__ overridden') + self.assertEqual("{}".format(s), '__str__ overridden') def test_from_format(self): # Ensure that PyUnicode_FromFormat() raises an error for a non-ascii |