Skip to content

Commit

Permalink
Add test case for issue #1396
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Aug 22, 2020
1 parent 9a6530c commit ff1ccda
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,3 +535,32 @@ def test_combine_as_does_not_lose_comments_issue_1381():
from appsettings import AppSettings, ObjectSetting, StringSetting # type: ignore
"""
assert "# type: ignore" in isort.code(test_input, combine_as_imports=True)


def test_incorrect_grouping_when_comments_issue_1396():
"""Test to ensure isort groups import correct independent of the comments present.
See: https://github.com/timothycrosley/isort/issues/1396
"""
assert isort.code(
"""from django.shortcuts import render
from apps.profiler.models import Project
from django.contrib.auth.decorators import login_required
from django.views.generic import (
# ListView,
# DetailView,
TemplateView,
# CreateView,
# View
)
""",
line_length=88,
known_first_party=["apps"],
known_django=["django"],
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
) == """from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.views.generic import \\
TemplateView # ListView,; DetailView,; CreateView,; View
from apps.profiler.models import Project
"""

0 comments on commit ff1ccda

Please sign in to comment.