summaryrefslogtreecommitdiff
path: root/test_isort.py
diff options
context:
space:
mode:
authorh-hirokawa <h.hirokawa@realglobe.jp>2017-12-12 12:53:10 +0900
committerh-hirokawa <h.hirokawa@realglobe.jp>2017-12-12 12:54:50 +0900
commit5b55e8210a852c75cfaaeaaebc02fd13ff8ae048 (patch)
tree0a9da8e86bcbf9a9961a9a173be177fc2ecf0ff1 /test_isort.py
parent08ef3a184429cb5a57a740c473ce0871816890b4 (diff)
downloadisort-5b55e8210a852c75cfaaeaaebc02fd13ff8ae048.tar.gz
Add output property to SortImports instance when the file contents contains `isort:skip_file`.
Diffstat (limited to 'test_isort.py')
-rw-r--r--test_isort.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/test_isort.py b/test_isort.py
index 6dbb7c2b..456ef6f4 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -501,9 +501,10 @@ def test_skip_with_file_name():
test_input = ("import django\n"
"import myproject\n")
- skipped = SortImports(file_path='/baz.py', file_contents=test_input, known_third_party=['django'],
- skip=['baz.py']).skipped
- assert skipped
+ sort_imports = SortImports(file_path='/baz.py', file_contents=test_input, known_third_party=['django'],
+ skip=['baz.py'])
+ assert sort_imports.skipped
+ assert sort_imports.output is None
def test_skip_within_file():
@@ -511,8 +512,9 @@ def test_skip_within_file():
test_input = ("# isort:skip_file\n"
"import django\n"
"import myproject\n")
-
- assert SortImports(file_contents=test_input, known_third_party=['django']).skipped
+ sort_imports = SortImports(file_contents=test_input, known_third_party=['django'])
+ assert sort_imports.skipped
+ assert sort_imports.output is None
def test_force_to_top():
@@ -2200,7 +2202,7 @@ def test_ensure_as_imports_sort_correctly_within_from_imports_issue_590():
'from os import pathsep as separator\n')
assert SortImports(file_contents=test_input, force_single_line=True).output == test_input
-
+
def test_ensure_line_endings_are_preserved_issue_493():
"""Test to ensure line endings are not converted"""
test_input = ('from os import defpath\r\n'
@@ -2213,7 +2215,7 @@ def test_ensure_line_endings_are_preserved_issue_493():
'from os import pathsep as separator\n')
assert SortImports(file_contents=test_input).output == test_input
-
+
def test_not_splitted_sections():
whiteline = '\n'
stdlib_section = 'import unittest\n'
@@ -2238,4 +2240,3 @@ def test_not_splitted_sections():
)
assert SortImports(file_contents=test_input, no_lines_before=['FIRSTPARTY', 'LOCALFOLDER']).output == \
(stdlib_section + firstparty_section + local_section + whiteline + statement)
-