From 67fb11ba05d2502d8b4367cfe98ac37cc3186488 Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Sat, 19 Sep 2020 21:04:27 -0700 Subject: [PATCH] Extend testing to include paren case --- tests/unit/test_regressions.py | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_regressions.py b/tests/unit/test_regressions.py index cd5b9ec45..72e041da4 100644 --- a/tests/unit/test_regressions.py +++ b/tests/unit/test_regressions.py @@ -964,23 +964,23 @@ def test_isort_should_leave_non_import_from_lines_alone(): yield_from_should_be_ignored = """ def generator_function(): yield \\ - from [] + from other_function()[1] """ assert isort.check_code(yield_from_should_be_ignored, show_diff=True) - comment_should_not_cause_ignore = """ + wont_ignore_comment_contiuation = """ # one # two def function(): - # one \\ + # three \\ import b import a """ assert ( - isort.code(comment_should_not_cause_ignore) + isort.code(wont_ignore_comment_contiuation) == """ # one @@ -988,8 +988,31 @@ def function(): def function(): - # one \\ + # three \\ import a import b """ ) + + will_ignore_if_non_comment_continuation = """ +# one + +# two + + +def function(): + print \\ + import b + import a +""" + assert isort.check_code(will_ignore_if_non_comment_continuation, show_diff=True) + + yield_from_parens_should_be_ignored = """ +def generator_function(): + ( + yield + from other_function()[1] + ) +""" + assert isort.check_code(yield_from_parens_should_be_ignored, show_diff=True) +