Skip to content

Commit

Permalink
Add test for #1604: allow toggling section header in indented imports
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Dec 10, 2020
1 parent 5b143e3 commit 8647eb0
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/unit/test_ticketed_features.py
Expand Up @@ -923,3 +923,51 @@ def one():
import os
"""
)


def test_indented_import_headings_issue_1604():
"""Test to ensure it is possible to toggle import headings on indented import sections
See: https://github.com/PyCQA/isort/issues/1604
"""
assert (
isort.code(
"""
import numpy as np
def function():
import numpy as np
""",
import_heading_thirdparty="External imports",
)
== """
# External imports
import numpy as np
def function():
# External imports
import numpy as np
"""
)
assert (
isort.code(
"""
import numpy as np
def function():
import numpy as np
""",
import_heading_thirdparty="External imports",
indented_import_headings=False,
)
== """
# External imports
import numpy as np
def function():
import numpy as np
"""
)

0 comments on commit 8647eb0

Please sign in to comment.