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

Emily Morehouse webhook-mailer at python.org
Fri Feb 1 17:27:46 EST 2019


https://github.com/python/cpython/commit/ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24
commit: ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24
branch: master
author: Emily Morehouse <emilyemorehouse at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-02-01T15:27:38-07:00
summary:

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

files:
M Lib/test/test_named_expressions.py

diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py
index ff426f4cea29..e15111cf3839 100644
--- a/Lib/test/test_named_expressions.py
+++ b/Lib/test/test_named_expressions.py
@@ -195,7 +195,7 @@ def test_named_expression_assignment_14(self):
         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 @@ def test_named_expression_assignment_14(self):
 
         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):
 



More information about the Python-checkins mailing list