summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-11-20 18:28:28 (GMT)
committerGitHub <noreply@github.com>2021-11-20 18:28:28 (GMT)
commit81f4e116ef7d30ef6e2041c2d6cf29af511a3a02 (patch)
tree73b411df7a7dc4c50c78b0fa19e063d1bdbd72f1 /Lib/test/test_syntax.py
parent7a1d9325287a39528b795b1e8037146777abfe3e (diff)
downloadcpython-81f4e116ef7d30ef6e2041c2d6cf29af511a3a02.zip
cpython-81f4e116ef7d30ef6e2041c2d6cf29af511a3a02.tar.gz
cpython-81f4e116ef7d30ef6e2041c2d6cf29af511a3a02.tar.bz2
bpo-45811: Improve error message when source code contains invisible control characters (GH-29654)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r--Lib/test/test_syntax.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index 28414ba..fc3c629 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -1566,6 +1566,9 @@ def func2():
for paren in ")]}":
self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
+ def test_invisible_characters(self):
+ self._check_error('print\x17("Hello")', "invalid non-printable character")
+
def test_match_call_does_not_raise_syntax_error(self):
code = """
def match(x):