Skip to content

Commit

Permalink
Formatting (black + isort)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Sep 1, 2020
1 parent 3903d34 commit b3a22bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions isort/wrap_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ def grid(**interface):
len(next_statement.split(interface["line_separator"])[-1]) + 1
> interface["line_length"]
):
lines = [f"{white_space}{next_import.split(' ')[0]}"]
lines = [f"{interface['white_space']}{next_import.split(' ')[0]}"]
for part in next_import.split(" ")[1:]:
new_line = f"{lines[-1]} {part}"
if len(new_line) + 1 > interface["line_length"]:
lines.append(f"{white_space}{part}")
lines.append(f"{interface['white_space']}{part}")
else:
lines[-1] = new_line
next_import = interface["line_separator"].join(lines)
Expand Down
12 changes: 10 additions & 2 deletions tests/unit/test_wrap_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,24 @@ def test_backslash_grid():
"""Tests the backslash_grid grid wrap mode, ensuring it matches formatting expectations.
See: https://github.com/PyCQA/isort/issues/1434
"""
assert isort.code("""
assert (
isort.code(
"""
from kopf.engines import loggers, posting
from kopf.reactor import causation, daemons, effects, handling, lifecycles, registries
from kopf.storage import finalizers, states
from kopf.structs import (bodies, configuration, containers, diffs,
handlers as handlers_, patches, resources)
""", multi_line_output=11, line_length=88, combine_as_imports=True) == """
""",
multi_line_output=11,
line_length=88,
combine_as_imports=True,
)
== """
from kopf.engines import loggers, posting
from kopf.reactor import causation, daemons, effects, handling, lifecycles, registries
from kopf.storage import finalizers, states
from kopf.structs import bodies, configuration, containers, diffs, \\
handlers as handlers_, patches, resources
"""
)

0 comments on commit b3a22bc

Please sign in to comment.