summaryrefslogtreecommitdiff
path: root/Lib/test/test_ast.py
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2012-11-25 14:36:26 +0000
committerMark Dickinson <mdickinson@enthought.com>2012-11-25 14:36:26 +0000
commit5cd62b7fe17e8004a4f137cf9164e4e71bb1bd70 (patch)
tree9c1de9548873ed64ed849a3de5997b9cec1f3aff /Lib/test/test_ast.py
parentfbce793218005f0778f70a840b1e2bf688f9bb0f (diff)
downloadcpython-5cd62b7fe17e8004a4f137cf9164e4e71bb1bd70.tar.gz
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 a8853c7e21..dc24126b21 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):