Commit aae5b9e9 authored by Stefan Behnel's avatar Stefan Behnel

fix test in Py2.6

parent 7696a805
...@@ -138,7 +138,7 @@ class AsyncBadSyntaxTest(unittest.TestCase): ...@@ -138,7 +138,7 @@ class AsyncBadSyntaxTest(unittest.TestCase):
'{await a: a for a in b}'}: '{await a: a for a in b}'}:
with self.assertRaisesRegex(Errors.CompileError, 'await.*in comprehen'): with self.assertRaisesRegex(Errors.CompileError, 'await.*in comprehen'):
exec('async def f():\n\t{}'.format(comp), ns, ns) exec('async def f():\n\t{0}'.format(comp), ns, ns)
def test_badsyntax_10(self): def test_badsyntax_10(self):
# Tests for issue 24619 # Tests for issue 24619
...@@ -306,7 +306,8 @@ class AsyncBadSyntaxTest(unittest.TestCase): ...@@ -306,7 +306,8 @@ class AsyncBadSyntaxTest(unittest.TestCase):
"""] """]
for code in samples: for code in samples:
with self.subTest(code=code), self.assertRaises(Errors.CompileError): # assertRaises() differs in Py2.6, so use our own assertRaisesRegex() instead
with self.subTest(code=code), self.assertRaisesRegex(Errors.CompileError, '.'):
exec(code, {}, {}) exec(code, {}, {})
if not hasattr(unittest.TestCase, 'subTest'): if not hasattr(unittest.TestCase, 'subTest'):
......
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