Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Oct 10, 2020
1 parent 8b9e45e commit e478e7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions isort/wrap_modes.py
Expand Up @@ -273,11 +273,11 @@ def vertical_hanging_indent_bracket(**interface):
def vertical_prefix_from_module_import(**interface):
if not interface["imports"]:
return ""

prefix_statement = interface["statement"]
output_statement = prefix_statement + interface["imports"].pop(0)
comments = interface["comments"]

statement = output_statement
statement_with_comments = ""
for next_import in interface["imports"]:
Expand All @@ -294,7 +294,7 @@ def vertical_prefix_from_module_import(**interface):
):
statement = (
isort.comments.add_to_line(
interface["comments"],
comments,
output_statement,
removed=interface["remove_comments"],
comment_prefix=interface["comment_prefix"],
Expand All @@ -303,11 +303,11 @@ def vertical_prefix_from_module_import(**interface):
)
comments = []
output_statement = statement

if comments and statement_with_comments:
output_statement = statement_with_comments
return output_statement


@_wrap_mode
def hanging_indent_with_parentheses(**interface):
Expand Down
13 changes: 8 additions & 5 deletions tests/unit/test_regressions.py
Expand Up @@ -1429,20 +1429,23 @@ def test_isort_losing_imports_vertical_prefix_from_module_import_wrap_mode_issue
wrap mode VERTICAL_PREFIX_FROM_MODULE_IMPORT is used.
See: https://github.com/PyCQA/isort/issues/1542.
"""
assert isort.code(
"""
assert (
isort.code(
"""
from xxxxxxxxxxxxxxxx import AAAAAAAAAA, BBBBBBBBBB
from xxxxxxxxxxxxxxxx import CCCCCCCCC, DDDDDDDDD # xxxxxxxxxxxxxxxxxx
print(CCCCCCCCC)
""",
multi_line_output=9,
) == """
multi_line_output=9,
)
== """
from xxxxxxxxxxxxxxxx import AAAAAAAAAA, BBBBBBBBBB # xxxxxxxxxxxxxxxxxx
from xxxxxxxxxxxxxxxx import CCCCCCCCC, DDDDDDDDD
print(CCCCCCCCC)
"""
)

assert isort.check_code(
"""
Expand All @@ -1452,6 +1455,6 @@ def test_isort_losing_imports_vertical_prefix_from_module_import_wrap_mode_issue
print(CCCCCCCCC)
""",
show_diff = True,
show_diff=True,
multi_line_output=9,
)

0 comments on commit e478e7c

Please sign in to comment.