##// END OF EJS Templates
`async_safe` cleanup
BaoGiang HoangVu -
Show More
@@ -205,10 +205,6 b' class AsyncTest(TestCase):'
205 # yield is allowed in async functions, starting in Python 3.6,
205 # yield is allowed in async functions, starting in Python 3.6,
206 # and yield from is not allowed in any version
206 # and yield from is not allowed in any version
207 vals = ('return', 'yield', 'yield from (_ for _ in range(3))')
207 vals = ('return', 'yield', 'yield from (_ for _ in range(3))')
208 async_safe = (True,
209 True,
210 False)
211 vals = tuple(zip(vals, async_safe))
212
208
213 success_tests = zip(self._get_top_level_cases(), repeat(False))
209 success_tests = zip(self._get_top_level_cases(), repeat(False))
214 failure_tests = zip(self._get_ry_syntax_errors(), repeat(True))
210 failure_tests = zip(self._get_ry_syntax_errors(), repeat(True))
@@ -219,14 +215,12 b' class AsyncTest(TestCase):'
219 for (test_name, test_case), should_fail in tests:
215 for (test_name, test_case), should_fail in tests:
220 nested_case = nest_case(context, test_case)
216 nested_case = nest_case(context, test_case)
221
217
222 for val, async_safe in vals:
218 for val in vals:
223 val_should_fail = should_fail
224
225 test_id = (context_name, test_name, val)
219 test_id = (context_name, test_name, val)
226 cell = nested_case.format(val=val)
220 cell = nested_case.format(val=val)
227
221
228 with self.subTest(test_id):
222 with self.subTest(test_id):
229 if val_should_fail:
223 if should_fail:
230 msg = ("SyntaxError not raised for %s" %
224 msg = ("SyntaxError not raised for %s" %
231 str(test_id))
225 str(test_id))
232 with self.assertRaises(SyntaxError, msg=msg):
226 with self.assertRaises(SyntaxError, msg=msg):
General Comments 0
You need to be logged in to leave comments. Login now