Skip to content

Commit

Permalink
Also fix styling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Jan 18, 2025
1 parent e264241 commit 3110618
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion isort/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,11 @@ def _with_from_imports(
):
do_multiline_reformat = True

if import_statement and config.split_on_trailing_comma and module in parsed.trailing_commas:
if (
import_statement
and config.split_on_trailing_comma
and module in parsed.trailing_commas
):
import_statement = wrap.import_statement(
import_start=import_start,
from_imports=from_import_section,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/profiles/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ def sub(a: np.ndarray, b: np.ndarray) -> np.ndarray: ...

def test_black_trailing_comma():
black_test(
"from x import (a, b, c,)\n",
"""\
"from x import (a, b, c,)\n",
"""\
from x import (
a,
b,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -5587,6 +5587,7 @@ def test_split_on_trailing_comma_wih_as() -> None:
output = isort.code(expected_output, split_on_trailing_comma=True)
assert output == expected_output


def test_infinite_loop_in_unmatched_parenthesis() -> None:
test_input = "from os import ("

Expand Down

0 comments on commit 3110618

Please sign in to comment.