-
-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #1398: isort: off comment doesn't work, if it's the top comment…
… in the file.
- Loading branch information
1 parent
66bc89f
commit 9a6530c
Showing
2 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"""Tests for isort action comments, such as isort: skip""" | ||
import isort | ||
|
||
|
||
def test_isort_off_and_on(): | ||
"""Test so ensure isort: off action comment and associated on action comment work together""" | ||
|
||
# as top of file comment | ||
assert ( | ||
isort.code( | ||
"""# isort: off | ||
import a | ||
import a | ||
# isort: on | ||
import a | ||
import a | ||
""" | ||
) | ||
== """# isort: off | ||
import a | ||
import a | ||
# isort: on | ||
import a | ||
""" | ||
) | ||
# as middle comment | ||
assert ( | ||
isort.code( | ||
""" | ||
import a | ||
import a | ||
# isort: off | ||
import a | ||
import a | ||
""" | ||
) | ||
== """ | ||
import a | ||
# isort: off | ||
import a | ||
import a | ||
""" | ||
) |