| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Jython
Revision: 5234
Author: pjenvey
Date: 22 Aug 2008 16:16:59
Changes:fix unicode __add__ and repeat always forcing the basic plane on the result --
can't optimize for strs when unicode also uses these methods
| ... | ...@@ -0,0 +1,28 @@ | |
| 1 | """Misc unicode tests | |
| 2 | ||
| 3 | Made for Jython. | |
| 4 | """ | |
| 5 | import re | |
| 6 | import unittest | |
| 7 | from test import test_support | |
| 8 | ||
| 9 | class UnicodeTestCase(unittest.TestCase): | |
| 10 | ||
| 11 | def test_simplejson_plane_bug(self): | |
| 12 | # a bug exposed by simplejson: unicode __add__ was always | |
| 13 | # forcing the basic plane | |
| 14 | chunker = re.compile(r'(.*?)(["\\\x00-\x1f])', re.VERBOSE | re.MULTILINE | re.DOTALL) | |
| 15 | orig = u'z\U0001d120x' | |
| 16 | quoted1 = u'"z\U0001d120x"' | |
| 17 | quoted2 = '"' + orig + '"' | |
| 18 | # chunker re gives different results depending on the plane | |
| 19 | self.assertEqual(chunker.match(quoted1, 1).groups(), (orig, u'"')) | |
| 20 | self.assertEqual(chunker.match(quoted2, 1).groups(), (orig, u'"')) | |
| 21 | ||
| 22 | ||
| 23 | def test_main(): | |
| 24 | test_support.run_unittest(UnicodeTestCase) | |
| 25 | ||
| 26 | ||
| 27 | if __name__ == "__main__": | |
| 28 | test_main() |
| ... | ...@@ -670,7 +670,7 @@ | |
| 670 | 670 | for(int i = 0; i < count; i++) { |
| 671 | 671 | string.getChars(0, s, new_chars, i * s); |
| 672 | 672 | } |
| 673 | return createInstance(new String(new_chars), true); | |
| 673 | return createInstance(new String(new_chars)); | |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | @Override |
| ... | ...@@ -711,7 +711,7 @@ | |
| 711 | 711 | if (generic_other instanceof PyUnicode) { |
| 712 | 712 | return new PyUnicode(result); |
| 713 | 713 | } |
| 714 | return createInstance(result, true); | |
| 714 | return createInstance(result); | |
| 715 | 715 | } |
| 716 | 716 | else return null; |
| 717 | 717 | } |