summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-11-25 14:36:26 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2012-11-25 14:36:26 (GMT)
commitded35aeb9d5ae1671174f10c0ae8a7166693b17c (patch)
tree4caa61589581de32b38d3da8ee8bd68e553094bf /Lib/test/test_ast.py
parent9982c53c2feb6e6e03c4c6d87d77c6ee69bfc435 (diff)
downloadcpython-ded35aeb9d5ae1671174f10c0ae8a7166693b17c.zip
cpython-ded35aeb9d5ae1671174f10c0ae8a7166693b17c.tar.gz
cpython-ded35aeb9d5ae1671174f10c0ae8a7166693b17c.tar.bz2
Issue #16546: make ast.YieldFrom argument mandatory.
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r--Lib/test/test_ast.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index a8853c7..dc24126 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -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):