summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2021-06-20 21:15:11 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2021-06-20 21:15:11 -0700
commit4cb72fa93fdcd78df00687de7cd91428ab0fdc93 (patch)
tree4268588f0b36929e382daca3228079dff3be8489 /tests/unit
parenteada92819c9027b08a06ab51a57eb10730aa6933 (diff)
downloadisort-4cb72fa93fdcd78df00687de7cd91428ab0fdc93.tar.gz
Implemented #1722: Improved behavior for running isort in atomic mode over Cython source files.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_isort.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_isort.py b/tests/unit/test_isort.py
index 0599925e..c90f40d2 100644
--- a/tests/unit/test_isort.py
+++ b/tests/unit/test_isort.py
@@ -1408,6 +1408,17 @@ def test_atomic_mode() -> None:
with pytest.raises(ExistingSyntaxErrors):
isort.code(test_input, atomic=True)
+ # unless file is for Cython which doesn't yet provide a public AST parsing API
+ assert (
+ isort.code(test_input, extension="pyx", atomic=True, verbose=True)
+ == isort.code(test_input, extension="pyx", atomic=True)
+ == """from a import e, f
+from b import c, d
+
+while True print 'Hello world'
+"""
+ )
+
# ensure atomic works with streams
test_input = as_stream("from b import d, c\nfrom a import f, e\n")
test_output = UnreadableStream()