summaryrefslogtreecommitdiff
path: root/test_isort.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-03-01 12:16:43 +0100
committerDaniel Hahler <git@thequod.de>2019-03-01 12:17:49 +0100
commit93a04585381defde79323611c9a8f1cc418db71c (patch)
tree685df51c07bf7b2583760259c9f48d90f7834f14 /test_isort.py
parentf0badf18389935b0275660f8f3ef9899dc4c4f49 (diff)
downloadisort-93a04585381defde79323611c9a8f1cc418db71c.tar.gz
Fix no_lines_before with empty section
This fixes "no_lines_before" to also be respected from previous empty sections.
Diffstat (limited to 'test_isort.py')
-rw-r--r--test_isort.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test_isort.py b/test_isort.py
index b35d6cdd..412f3f31 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -2394,6 +2394,18 @@ def test_not_splitted_sections():
assert SortImports(file_contents=test_input, no_lines_before=['STDLIB']).output == test_input
+def test_no_lines_before_empty_section():
+ test_input = ('import first\n'
+ 'import custom\n')
+ assert SortImports(
+ file_contents=test_input,
+ known_third_party=["first"],
+ known_custom=["custom"],
+ sections=['THIRDPARTY', 'LOCALFOLDER', 'CUSTOM'],
+ no_lines_before=['THIRDPARTY', 'LOCALFOLDER', 'CUSTOM'],
+ ).output == test_input
+
+
def test_no_inline_sort():
"""Test to ensure multiple `from` imports in one line are not sorted if `--no-inline-sort` flag
is enabled. If `--force-single-line-imports` flag is enabled, then `--no-inline-sort` is ignored."""