Skip to content

Commit

Permalink
fix: correct group by package tokenization
Browse files Browse the repository at this point in the history
  • Loading branch information
glasnt committed May 19, 2023
1 parent b818cec commit 3d0efc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion isort/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def section_key(line: str, config: Config) -> str:
if match: # pragma: no cover - regex always matches if line starts with "from ."
line = f"from {' '.join(match.groups())}"
if config.group_by_package and line.strip().startswith("from"):
line = line.split(" import", 1)[0]
line = line.split(" import ", 1)[0]

if config.lexicographical:
line = _import_line_intro_re.sub("", _import_line_midline_import_re.sub(".", line))
Expand Down
1 change: 1 addition & 0 deletions tests/unit/profiles/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def test_google_code_snippet_shared_example():
google_isort_test(
"""from a import z
from a.b import c
from a.b import import_me
"""
)

Expand Down

0 comments on commit 3d0efc1

Please sign in to comment.