Skip to content

Commit 8f737e3

Browse files
committed
Fix assert in test and make error message more friendly
1 parent cd5e276 commit 8f737e3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/test/test_ast/test_ast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,8 @@ def test_constant_as_name(self):
823823

824824
def test_constant_as_unicode_name(self):
825825
for constant in b"Tru\xe1\xb5\x89", b"Fal\xc5\xbfe", b"N\xc2\xbane":
826-
with self.assertRaises(ValueError,
827-
msg="identifier must not be None, True or False after NFKC normalization"):
826+
with self.assertRaisesRegex(ValueError,
827+
"identifier must not be None, True or False after Unicode normalization \\(NKFC\\)"):
828828
ast.parse(constant, mode="eval")
829829

830830
def test_precedence_enum(self):

Parser/pegen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ _PyPegen_new_identifier(Parser *p, const char *n)
553553
_PyUnicode_EqualToASCIIString(id, "True") ||
554554
_PyUnicode_EqualToASCIIString(id, "False"))
555555
{
556-
PyErr_SetString(PyExc_ValueError, "identifier must not be None, True or False after NFKC normalization");
556+
PyErr_SetString(PyExc_ValueError, "identifier must not be None, True or False after Unicode normalization (NKFC)");
557557
Py_DECREF(id);
558558
goto error;
559559
}

0 commit comments

Comments
 (0)