Skip to content

Commit 7802b4f

Browse files
Add test case for issue #1645: Allowing sort order to be reversed
1 parent 0805019 commit 7802b4f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/unit/test_ticketed_features.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,3 +1029,33 @@ def test_isort_auto_detects_and_ignores_invalid_from_imports_issue_1688():
10291029
from package3 import also_ok
10301030
"""
10311031
)
1032+
1033+
1034+
def test_isort_allows_reversing_sort_order_issue_1645():
1035+
"""isort allows reversing the sort order for those who prefer Z or longer imports first.
1036+
see: https://github.com/PyCQA/isort/issues/1688
1037+
"""
1038+
assert (
1039+
isort.code(
1040+
"""
1041+
from xxx import (
1042+
g,
1043+
hi,
1044+
def,
1045+
abcd,
1046+
)
1047+
""",
1048+
profile="black",
1049+
reverse_sort=True,
1050+
length_sort=True,
1051+
line_length=20,
1052+
)
1053+
== """
1054+
from xxx import (
1055+
abcd,
1056+
def,
1057+
hi,
1058+
g,
1059+
)
1060+
"""
1061+
)

0 commit comments

Comments
 (0)