Skip to content

Commit

Permalink
Merge pull request #1717 from anirudnits/issue/1714
Browse files Browse the repository at this point in the history
Issue/1714 multiline tab bug
  • Loading branch information
timothycrosley authored Apr 30, 2021
2 parents 5e29571 + 2ca4261 commit 2402dae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions isort/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
else:
while line.strip().endswith("\\"):
line, new_comment = parse_comments(in_lines[index])
line = line.lstrip()
index += 1
if new_comment:
comments.append(new_comment)
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -4095,6 +4095,14 @@ def test_isort_keeps_comments_issue_691() -> None:
assert isort.code(test_input) == expected_output


def test_isort_multiline_with_tab_issue_1714() -> None:
test_input = "from sys \\ \n" "\timport version\n" "print(version)\n"

expected_output = "from sys import version\n" "\n" "print(version)\n"

assert isort.code(test_input) == expected_output


def test_isort_ensures_blank_line_between_import_and_comment() -> None:
config = {
"ensure_newline_before_comments": True,
Expand Down

0 comments on commit 2402dae

Please sign in to comment.