Benjamin Peterson avatar Benjamin Peterson committed 3e9c882

normalization is different between unicode builds, so use a new non-BMP char and add normalization test

Comments (0)

Files changed (1)


 import unittest
+import sys
 from test import support
 class PEP3131Test(unittest.TestCase):
             ä = 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
     def test_invalid(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.