Unverified Kaydet (Commit) ac19081c authored tarafından Emily Morehouse's avatar Emily Morehouse Kaydeden (comit) GitHub

bpo-35877: Add test for while loop named expression without parentheses (GH-11726)

üst d4fceaaf
...@@ -195,7 +195,7 @@ class NamedExpressionAssignmentTest(unittest.TestCase): ...@@ -195,7 +195,7 @@ class NamedExpressionAssignmentTest(unittest.TestCase):
Where all variables are positive integers, and a is at least as large 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 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 root of x (and roughly doubling the number of accurate bits per
iteration):: iteration):
""" """
a = 9 a = 9
n = 2 n = 2
...@@ -206,6 +206,12 @@ class NamedExpressionAssignmentTest(unittest.TestCase): ...@@ -206,6 +206,12 @@ class NamedExpressionAssignmentTest(unittest.TestCase):
self.assertEqual(a, 1) 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): class NamedExpressionScopeTest(unittest.TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment