Skip to content

Commit 3cc44e8

Browse files
authored
Merge pull request #2136 from glasnt/fix/issue-2135
fix: correct group by package tokenization
2 parents baf1112 + 3d0efc1 commit 3cc44e8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

isort/sorting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def section_key(line: str, config: Config) -> str:
6666
if match: # pragma: no cover - regex always matches if line starts with "from ."
6767
line = f"from {' '.join(match.groups())}"
6868
if config.group_by_package and line.strip().startswith("from"):
69-
line = line.split(" import", 1)[0]
69+
line = line.split(" import ", 1)[0]
7070

7171
if config.lexicographical:
7272
line = _import_line_intro_re.sub("", _import_line_midline_import_re.sub(".", line))

tests/unit/profiles/test_google.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def test_google_code_snippet_shared_example():
1717
google_isort_test(
1818
"""from a import z
1919
from a.b import c
20+
from a.b import import_me
2021
"""
2122
)
2223

0 commit comments

Comments
 (0)