summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_named_expressions.py
diff options
context:
space:
mode:
authorEmily Morehouse <emilyemorehouse@gmail.com>2019-02-01 22:27:38 (GMT)
committerGitHub <noreply@github.com>2019-02-01 22:27:38 (GMT)
commitac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24 (patch)
treeb206c75b19c11202822852b956e8fa7b12bb0769 /Lib/test/test_named_expressions.py
parentd4fceaafb8e3f8700d9ec6ab37a51e903392f74f (diff)
downloadcpython-ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24.zip
cpython-ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24.tar.gz
cpython-ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24.tar.bz2
bpo-35877: Add test for while loop named expression without parentheses (GH-11726)
Diffstat (limited to 'Lib/test/test_named_expressions.py')
-rw-r--r--Lib/test/test_named_expressions.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py
index ff426f4..e15111c 100644
--- a/Lib/test/test_named_expressions.py
+++ b/Lib/test/test_named_expressions.py
@@ -195,7 +195,7 @@ class NamedExpressionAssignmentTest(unittest.TestCase):
Where all variables are positive integers, and a is at least as large
as the n'th root of x, this algorithm returns the floor of the n'th
root of x (and roughly doubling the number of accurate bits per
- iteration)::
+ iteration):
"""
a = 9
n = 2
@@ -206,6 +206,12 @@ class NamedExpressionAssignmentTest(unittest.TestCase):
self.assertEqual(a, 1)
+ def test_named_expression_assignment_15(self):
+ while a := False:
+ pass # This will not run
+
+ self.assertEqual(a, False)
+
class NamedExpressionScopeTest(unittest.TestCase):