Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r89070:8cd625f42c0d
Date: 2016-12-15 15:04 +0100
http://bitbucket.org/pypy/pypy/changeset/8cd625f42c0d/
Log: adapt test to pypy's exact behavior
diff --git a/lib-python/3/test/test_grammar.py
b/lib-python/3/test/test_grammar.py
--- a/lib-python/3/test/test_grammar.py
+++ b/lib-python/3/test/test_grammar.py
@@ -1,7 +1,7 @@
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
-from test.support import check_syntax_error
+from test.support import check_syntax_error, check_impl_detail
import inspect
import unittest
import sys
@@ -419,8 +419,16 @@
with self.assertRaisesRegex(SyntaxError, custom_msg):
exec(source)
source = source.replace("foo", "(foo.)")
+ # PyPy's parser also detects the same "Missing parentheses"
+ # if there are some parentheses later in the line
+ # (above, the cases that contain '{1:').
+ # CPython gives up in this case.
+ if check_impl_detail(pypy=True) and '{1:' in source:
+ expected = custom_msg
+ else:
+ expected = "invalid syntax"
with self.subTest(source=source):
- with self.assertRaisesRegex(SyntaxError, "invalid syntax"):
+ with self.assertRaisesRegex(SyntaxError, expected):
exec(source)
def test_del_stmt(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit