bpo-35877: Make parenthesis optional for named expression in while statement (GH-11724)

* Add parenthesis optional in named expressions for while statement

* Add NEWS entry
This commit is contained in:
Xtreak 2019-02-02 03:10:16 +05:30 committed by Emily Morehouse
parent 85d83ec7c9
commit d4fceaafb8
4 changed files with 5 additions and 2 deletions

View file

@ -426,6 +426,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
self.check_suite("(a := 1)")
self.check_suite("(a := a)")
self.check_suite("if (match := pattern.search(data)) is None: pass")
self.check_suite("while match := pattern.search(f.read()): pass")
self.check_suite("[y := f(x), y**2, y**3]")
self.check_suite("filtered_data = [y for x in data if (y := f(x)) is None]")
self.check_suite("(y := f(x))")