Skip to content

Commit

Permalink
[9999] Add percent symbol as "string operator"
Browse files Browse the repository at this point in the history
  • Loading branch information
bbugyi200 committed May 31, 2021
1 parent e120f45 commit f2ccbf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/black/trans.py
Expand Up @@ -739,14 +739,15 @@ class BaseStringSplitter(StringTransformer):
"""

STRING_OPERATORS = [
token.PLUS,
token.STAR,
token.EQEQUAL,
token.NOTEQUAL,
token.LESS,
token.LESSEQUAL,
token.GREATER,
token.GREATEREQUAL,
token.LESS,
token.LESSEQUAL,
token.NOTEQUAL,
token.PERCENT,
token.PLUS,
token.STAR,
]

@abstractmethod
Expand Down
7 changes: 7 additions & 0 deletions tests/data/long_strings__edge_case.py
Expand Up @@ -31,6 +31,7 @@
return f'{x}/b/c/d/d/d/dadfjsadjsaidoaisjdsfjaofjdfijaidfjaodfjaoifjodjafojdoajaaaaaaaaaaaa'
assert str(result) == "This long string should be split at some point right close to or around hereeeeeee"
assert str(result) < "This long string should be split at some point right close to or around hereeeeee"
assert "A format string: %s" % "This long string should be split at some point right close to or around hereeeeeee" != result


# output
Expand Down Expand Up @@ -120,3 +121,9 @@
< "This long string should be split at some point right close to or around"
" hereeeeee"
)
assert (
"A format string: %s"
% "This long string should be split at some point right close to or around"
" hereeeeeee"
!= result
)

0 comments on commit f2ccbf5

Please sign in to comment.