summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-04-22 18:08:49 (GMT)
committerGitHub <noreply@github.com>2022-04-22 18:08:49 (GMT)
commit9c18d783c38fca57a63b61aa778d8a8d18945d95 (patch)
tree159220c7d865223e90a10f44e247ac90f36438bd /Lib/test/test_re.py
parent9f8b9a3506fefeba01a18eda0e06c037393be4bf (diff)
downloadcpython-9c18d783c38fca57a63b61aa778d8a8d18945d95.zip
cpython-9c18d783c38fca57a63b61aa778d8a8d18945d95.tar.gz
cpython-9c18d783c38fca57a63b61aa778d8a8d18945d95.tar.bz2
[3.10] gh-90568: Fix exception type for \N with a named sequence in RE (GH-91665) (GH-91830)
re.error is now raised instead of TypeError. (cherry picked from commit 6ccfa31421393910b52936e0447625db06f2a655)
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 9e5223a..305ec8e 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -754,6 +754,10 @@ class ReTests(unittest.TestCase):
"undefined character name 'SPAM'", 0)
self.checkPatternError(r'[\N{SPAM}]',
"undefined character name 'SPAM'", 1)
+ self.checkPatternError(r'\N{KEYCAP NUMBER SIGN}',
+ "undefined character name 'KEYCAP NUMBER SIGN'", 0)
+ self.checkPatternError(r'[\N{KEYCAP NUMBER SIGN}]',
+ "undefined character name 'KEYCAP NUMBER SIGN'", 1)
self.checkPatternError(br'\N{LESS-THAN SIGN}', r'bad escape \N', 0)
self.checkPatternError(br'[\N{LESS-THAN SIGN}]', r'bad escape \N', 1)