[Python-checkins] cpython (3.2): normalization is different between unicode builds, so use a new non-BMP char

benjamin.peterson python-checkins at python.org
Sat Aug 13 06:36:03 CEST 2011


http://hg.python.org/cpython/rev/3e9c882808b3
changeset:   71851:3e9c882808b3
branch:      3.2
parent:      71848:787ed1a7aba8
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Aug 12 23:35:34 2011 -0500
summary:
  normalization is different between unicode builds, so use a new non-BMP char and add normalization test

files:
  Lib/test/test_pep3131.py |  15 ++++++++++++---
  1 files changed, 12 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_pep3131.py b/Lib/test/test_pep3131.py
--- a/Lib/test/test_pep3131.py
+++ b/Lib/test/test_pep3131.py
@@ -1,4 +1,5 @@
 import unittest
+import sys
 from test import support
 
 class PEP3131Test(unittest.TestCase):
@@ -8,12 +9,20 @@
             ä = 1
             µ = 2 # this is a compatibility character
             蟒 = 3
-            𝔘𝔫𝔦𝔠𝔬𝔡𝔢  = 4
+            x󠄀 = 4
         self.assertEqual(getattr(T, "\xe4"), 1)
         self.assertEqual(getattr(T, "\u03bc"), 2)
         self.assertEqual(getattr(T, '\u87d2'), 3)
-        v = getattr(T, "\U0001d518\U0001d52b\U0001d526\U0001d520\U0001d52c\U0001d521\U0001d522")
-        self.assertEqual(v, 4)
+        self.assertEqual(getattr(T, 'x\U000E0100'), 4)
+
+    def test_non_bmp_normalized(self):
+        𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = 1
+        # On wide builds, this is normalized, but on narrow ones it is not. See
+        # #12746.
+        try:
+            self.assertIn("𝔘𝔫𝔦𝔠𝔬𝔡𝔢", dir())
+        except AssertionError:
+            raise unittest.case._ExpectedFailure(sys.exc_info())
 
     def test_invalid(self):
         try:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list