From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Mon, 26 Apr 2021 15:28:42 +0000 (-0400) Subject: Don't strip parens in assert / return with assign expr (#2143) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/db30456916ca733d011a2774e66beb3dd7064e14?ds=inline;hp=db30456916ca733d011a2774e66beb3dd7064e14 Don't strip parens in assert / return with assign expr (#2143) Black would previously strip the parenthesis away from statements like this these ones: assert (spam := 12 + 1) return (cheese := 1 - 12) Which happens to be invalid code. Now before making the parenthesis invisible, Black checks if the assignment expression's parent is an assert stamtment, aborting if True. Raise, yield, and await are already handled fine. I added a bunch of test cases from the PEP defining asssignment expressions (PEP 572). ---