Commit 32425ed8 authored by Stefan Behnel's avatar Stefan Behnel

make syntax tests actually use Cython (and not Python)

parent 58fc7970
......@@ -72,6 +72,10 @@ def exec(code_string, l, g):
g.update(ns)
def compile(code_string, module, level):
exec(code_string, {}, {})
class AsyncYieldFrom(object):
def __init__(self, obj):
self.obj = obj
......@@ -461,7 +465,7 @@ class AsyncBadSyntaxTest(unittest.TestCase):
"""]
for code in samples:
with self.subTest(code=code), self.assertRaises(SyntaxError):
with self.subTest(code=code), self.assertRaisesRegex(Errors.CompileError, '.'):
compile(code, "<test>", "exec")
def test_badsyntax_2(self):
......@@ -496,17 +500,16 @@ class AsyncBadSyntaxTest(unittest.TestCase):
"""async = 1""",
"""print(await=1)"""
# FIXME: cannot currently request Py3 syntax in cython.inline()
#"""print(await=1)"""
]
for code in samples:
with self.subTest(code=code), self.assertWarnsRegex(
DeprecationWarning,
"'await' will become reserved keywords"):
with self.subTest(code=code): # , self.assertRaisesRegex(Errors.CompileError, '.'):
compile(code, "<test>", "exec")
def test_badsyntax_3(self):
with self.assertRaises(DeprecationWarning):
#with self.assertRaises(DeprecationWarning):
with warnings.catch_warnings():
warnings.simplefilter("error")
compile("async = 1", "<test>", "exec")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment