summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-10-31 10:37:50 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-10-31 10:37:50 (GMT)
commitb1847e7541e7c8e8e064c6de1aa1adb199c007e3 (patch)
tree4735d5a4be86efae84ead31f7c0d206eb4a7b8aa /Lib/test/test_re.py
parent36ac51095634c7b1c29432db5c60e1eeca620977 (diff)
downloadcpython-b1847e7541e7c8e8e064c6de1aa1adb199c007e3.zip
cpython-b1847e7541e7c8e8e064c6de1aa1adb199c007e3.tar.gz
cpython-b1847e7541e7c8e8e064c6de1aa1adb199c007e3.tar.bz2
Issue #17381: Fixed handling of case-insensitive ranges in regular expressions.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index fb57305..3fd6ab0 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -583,6 +583,25 @@ class ReTests(unittest.TestCase):
self.assertEqual(re.match(r"((a)\s(abc|a))", "a a", re.I).group(1), "a a")
self.assertEqual(re.match(r"((a)\s(abc|a)*)", "a aa", re.I).group(1), "a aa")
+ def test_ignore_case_range(self):
+ # Issues #3511, #17381.
+ self.assertTrue(re.match(r'[9-a]', '_', re.I))
+ self.assertIsNone(re.match(r'[9-A]', '_', re.I))
+ self.assertTrue(re.match(br'[9-a]', b'_', re.I))
+ self.assertIsNone(re.match(br'[9-A]', b'_', re.I))
+ self.assertTrue(re.match(r'[\xc0-\xde]', '\xd7', re.I))
+ self.assertIsNone(re.match(r'[\xc0-\xde]', '\xf7', re.I))
+ self.assertTrue(re.match(r'[\xe0-\xfe]', '\xf7', re.I))
+ self.assertIsNone(re.match(r'[\xe0-\xfe]', '\xd7', re.I))
+ self.assertTrue(re.match(r'[\u0430-\u045f]', '\u0450', re.I))
+ self.assertTrue(re.match(r'[\u0430-\u045f]', '\u0400', re.I))
+ self.assertTrue(re.match(r'[\u0400-\u042f]', '\u0450', re.I))
+ self.assertTrue(re.match(r'[\u0400-\u042f]', '\u0400', re.I))
+ self.assertTrue(re.match(r'[\U00010428-\U0001044f]', '\U00010428', re.I))
+ self.assertTrue(re.match(r'[\U00010428-\U0001044f]', '\U00010400', re.I))
+ self.assertTrue(re.match(r'[\U00010400-\U00010427]', '\U00010428', re.I))
+ self.assertTrue(re.match(r'[\U00010400-\U00010427]', '\U00010400', re.I))
+
def test_category(self):
self.assertEqual(re.match(r"(\s)", " ").group(1), " ")