Skip to content

Commit

Permalink
Improve test cases, add test for comment that looks like line continu…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
timothycrosley committed Sep 20, 2020
1 parent c24b120 commit e74dc82
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions tests/unit/test_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,40 @@ def test_isort_should_leave_non_import_from_lines_alone():
See: https://github.com/PyCQA/isort/issues/1488
"""
raise_from_should_be_ignored = """
raise SomeException("Blah") \
from exceptionsInfo.popitem()[1]
raise SomeException("Blah") \\
from exceptionsInfo.popitem()[1]
"""
assert isort.check(raise_from_should_be_ignored, show_diff=True)
assert isort.check_code(raise_from_should_be_ignored, show_diff=True)

yield_from_should_be_ignored = """
def generator_function():
yield \
yield \\
from []
"""
assert isort.check(raise_from_should_be_ignored, show_diff=True)
assert isort.check_code(yield_from_should_be_ignored, show_diff=True)

comment_should_not_cause_ignore = """
# one
# two
def function():
# one \\
import b
import a
"""
assert (
isort.code(comment_should_not_cause_ignore)
== """
# one
# two
def function():
# one \\
import a
import b
"""
)

0 comments on commit e74dc82

Please sign in to comment.