Skip to content

Commit

Permalink
[fix] Fix bug revealed by psf#1243
Browse files Browse the repository at this point in the history
  • Loading branch information
bbugyi200 committed Mar 15, 2020
1 parent 8d86723 commit 3aeb407
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion black.py
Original file line number Diff line number Diff line change
Expand Up @@ -3924,7 +3924,7 @@ def _assign_match(LL: List[Leaf]) -> Optional[int]:
# If this line is apart of an expression statement or is a function
# argument AND the first leaf contains a variable name...
if (
parent_type(LL[0]) in [syms.expr_stmt, syms.argument]
parent_type(LL[0]) in [syms.expr_stmt, syms.argument, syms.power]
and LL[0].type == token.NAME
):
is_valid_index = is_valid_index_factory(LL)
Expand Down
23 changes: 23 additions & 0 deletions tests/data/long_strings__regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,15 @@ def foo():
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)

class Step(StepBase):
def who(self):
self.cmd = 'SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name} {title}/P{passenger_association}'.format(
last_name=last_name,
first_name=first_name,
middle_name=middle_name,
title=title,
passenger_association=passenger_association,
)

# output

Expand Down Expand Up @@ -673,3 +682,17 @@ def foo():
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)


class Step(StepBase):
def who(self):
self.cmd = (
"SR AAAA-CORRECT NAME IS {last_name} {first_name}{middle_name}"
" {title}/P{passenger_association}".format(
last_name=last_name,
first_name=first_name,
middle_name=middle_name,
title=title,
passenger_association=passenger_association,
)
)

0 comments on commit 3aeb407

Please sign in to comment.