summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Decker <christian.decker@lookslikematrix.de>2021-10-27 11:24:30 +0200
committerChristian Decker <christian.decker@lookslikematrix.de>2021-10-27 11:24:30 +0200
commitf0f4645d49d78650032b330c14e4ca023c9763c6 (patch)
treec7d7f25591bab6993ce19da877b0216749eb3ed3 /tests
parent31c9daa84723e956039990f58d996bf24a6fe64c (diff)
downloadisort-f0f4645d49d78650032b330c14e4ca023c9763c6.tar.gz
handle without space after hash
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_isort.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/unit/test_isort.py b/tests/unit/test_isort.py
index 3467569f..c16a8436 100644
--- a/tests/unit/test_isort.py
+++ b/tests/unit/test_isort.py
@@ -837,6 +837,12 @@ def test_skip_within_file() -> None:
with pytest.raises(FileSkipped):
isort.code(test_input, known_third_party=["django"])
+def test_skip_comment_without_space_after_hash() -> None:
+ """Ensure skipping a whole file works."""
+ test_input = "#isort: skip_file\nimport django\nimport myproject\n"
+ with pytest.raises(FileSkipped):
+ isort.code(test_input, known_third_party=["django"])
+
def test_skip_comment_is_no_comment() -> None:
"""Ensure skipping a whole file works."""
test_input = "content = \"# isort:skip_file\""
@@ -849,7 +855,6 @@ def test_force_to_top() -> None:
test_output = isort.code(test_input, force_to_top=["lib5"])
assert test_output == "import lib5\nimport lib1\nimport lib2\nimport lib6\n"
-
def test_add_imports() -> None:
"""Ensures adding imports works as expected."""
test_input = "import lib6\nimport lib2\nimport lib5\nimport lib1\n\n"