mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #16546: make ast.YieldFrom argument mandatory.
This commit is contained in:
parent
9982c53c2f
commit
ded35aeb9d
7 changed files with 36 additions and 24 deletions
|
@ -399,6 +399,14 @@ class AST_Tests(unittest.TestCase):
|
|||
compile(m, "<test>", "exec")
|
||||
self.assertIn("string must be of type str", str(cm.exception))
|
||||
|
||||
def test_empty_yield_from(self):
|
||||
# Issue 16546: yield from value is not optional.
|
||||
empty_yield_from = ast.parse("def f():\n yield from g()")
|
||||
empty_yield_from.body[0].body[0].value.value = None
|
||||
with self.assertRaises(ValueError) as cm:
|
||||
compile(empty_yield_from, "<test>", "exec")
|
||||
self.assertIn("field value is required", str(cm.exception))
|
||||
|
||||
|
||||
class ASTHelpers_Test(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue