Skip to content

Commit ac19081

Browse files
bpo-35877: Add test for while loop named expression without parentheses (GH-11726)
1 parent d4fceaa commit ac19081

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_named_expressions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def test_named_expression_assignment_14(self):
195195
Where all variables are positive integers, and a is at least as large
196196
as the n'th root of x, this algorithm returns the floor of the n'th
197197
root of x (and roughly doubling the number of accurate bits per
198-
iteration)::
198+
iteration):
199199
"""
200200
a = 9
201201
n = 2
@@ -206,6 +206,12 @@ def test_named_expression_assignment_14(self):
206206

207207
self.assertEqual(a, 1)
208208

209+
def test_named_expression_assignment_15(self):
210+
while a := False:
211+
pass # This will not run
212+
213+
self.assertEqual(a, False)
214+
209215

210216
class NamedExpressionScopeTest(unittest.TestCase):
211217

0 commit comments

Comments
 (0)