Skip to content

Commit 271b7ed

Browse files
authored
Add test for isort skip file functionality
1 parent 95249fe commit 271b7ed

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_formatter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,4 +796,12 @@ def _is_valid(self, item):
796796
optimization_function = """def process(self,data):
797797
'''Single quote docstring with formatting issues.'''
798798
return{'result':[item for item in data if self._is_valid(item)]}"""
799-
_run_formatting_test(source_code, True, optimized_function=optimization_function, expected=expected)
799+
_run_formatting_test(source_code, True, optimized_function=optimization_function, expected=expected)
800+
801+
def test_sort_imports_skip_file():
802+
"""Test that isort skips files with # isort:skip_file."""
803+
code = """# isort:skip_file
804+
805+
import sys, os, json # isort will ignore this file completely"""
806+
new_code = sort_imports(code)
807+
assert new_code == code

0 commit comments

Comments
 (0)