summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2021-07-27 22:48:53 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2021-07-27 22:48:53 -0700
commit915aa6814cc7eef2305b336f4457c667e8f9fc38 (patch)
treeb76b3d0a30f329b496cad02f796d9a46d864052b /tests/unit
parent8ae8d5045bcc4b80850d22fc4191dc36552d4e5b (diff)
downloadisort-915aa6814cc7eef2305b336f4457c667e8f9fc38.tar.gz
Fixed #1792: Sorting literals sometimes ignored when placed on first few lines of file.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_regressions.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/unit/test_regressions.py b/tests/unit/test_regressions.py
index 449f83d5..1853893e 100644
--- a/tests/unit/test_regressions.py
+++ b/tests/unit/test_regressions.py
@@ -1828,3 +1828,44 @@ v = """
v=""""""
'''
)
+
+
+def test_literal_sort_at_top_of_file_issue_1792():
+ assert (
+ isort.code(
+ '''"""I'm a docstring! Look at me!"""
+
+# isort: unique-list
+__all__ = ["Foo", "Foo", "Bar"]
+
+from typing import final # arbitrary
+
+
+@final
+class Foo:
+ ...
+
+
+@final
+class Bar:
+ ...
+'''
+ )
+ == '''"""I'm a docstring! Look at me!"""
+
+# isort: unique-list
+__all__ = ['Bar', 'Foo']
+
+from typing import final # arbitrary
+
+
+@final
+class Foo:
+ ...
+
+
+@final
+class Bar:
+ ...
+'''
+ )