diff --git a/isort/sorting.py b/isort/sorting.py index 7ad70b22..976f00e4 100644 --- a/isort/sorting.py +++ b/isort/sorting.py @@ -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)) diff --git a/tests/unit/profiles/test_google.py b/tests/unit/profiles/test_google.py index 4a3b4131..b265e309 100644 --- a/tests/unit/profiles/test_google.py +++ b/tests/unit/profiles/test_google.py @@ -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 """ )