diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-01-06 08:50:52 -0800 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-01-06 08:50:52 -0800 |
commit | 4dc2a71af88d59b664a8bfdcfcc7acd6412bed76 (patch) | |
tree | 8495ce0ddfd9c3391e6eda45b8b94afacc34e1e7 /tests/test_isort.py | |
parent | f02f012c7c13b8caa946d782ef8f6775972972bd (diff) | |
download | isort-4dc2a71af88d59b664a8bfdcfcc7acd6412bed76.tar.gz |
Add cdef and cpdef support
Diffstat (limited to 'tests/test_isort.py')
-rw-r--r-- | tests/test_isort.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/test_isort.py b/tests/test_isort.py index 11a7079f..0228b414 100644 --- a/tests/test_isort.py +++ b/tests/test_isort.py @@ -4627,6 +4627,44 @@ IF CEF_VERSION == 3: SortImports(file_contents=test_input).output == expected_output +def test_cdef_support(): + assert ( + SortImports( + file_contents=""" +from cpython.version cimport PY_MAJOR_VERSION + +cdef extern from *: + ctypedef CefString ConstCefString "const CefString" +""" + ).output + == """ +from cpython.version cimport PY_MAJOR_VERSION + + +cdef extern from *: + ctypedef CefString ConstCefString "const CefString" +""" + ) + + assert ( + SortImports( + file_contents=""" +from cpython.version cimport PY_MAJOR_VERSION + +cpdef extern from *: + ctypedef CefString ConstCefString "const CefString" +""" + ).output + == """ +from cpython.version cimport PY_MAJOR_VERSION + + +cpdef extern from *: + ctypedef CefString ConstCefString "const CefString" +""" + ) + + def test_top_level_import_order() -> None: test_input = ( "from rest_framework import throttling, viewsets\n" |