Skip to content

Commit

Permalink
Add regression test for issue #1277
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 8, 2020
1 parent c0ebbd0 commit 4eb7352
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,31 @@ def func():


def test_add_imports_shouldnt_make_isort_unusable_issue_1297():
"""Test to ensure add imports doesn't cause any unexpected behaviour when combined with check"""
"""Test to ensure add imports doesn't cause any unexpected behaviour when combined with check
See: https://github.com/timothycrosley/isort/issues/1297
"""
assert isort.check_code(
"""from __future__ import unicode_literals
from os import path
""",
add_imports={"from __future__ import unicode_literals"},
)


def test_no_extra_lines_for_imports_in_functions_issue_1277():
"""Test to ensure isort doesn't introduce extra blank lines for imports within function.
See: https://github.com/timothycrosley/isort/issues/1277
"""
test_input = """
def main():
import time
import sys
"""
expected_output = """
def main():
import sys
import time
"""
assert isort.code(isort.code(isort.code(test_input))) == expected_output

0 comments on commit 4eb7352

Please sign in to comment.