diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2019-05-12 16:14:14 -0700 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2019-05-12 16:14:14 -0700 |
commit | 2327a2d846884505702e782fa4a52713d1312d3d (patch) | |
tree | 2ec2da8f6021a250430e7bb2a4fde6a2585b5672 | |
parent | cb2283ace001f242bfa3a886282e619a2e440141 (diff) | |
download | isort-2327a2d846884505702e782fa4a52713d1312d3d.tar.gz |
Add additional test cases for .pyi extension support, in particular from file based loading
-rw-r--r-- | test_isort.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test_isort.py b/test_isort.py index 7a9ab492..23de02de 100644 --- a/test_isort.py +++ b/test_isort.py @@ -2996,13 +2996,22 @@ def test_import_heading_issue_905(): assert SortImports(file_contents=test_input, **config).output == test_input -def test_pyi_formatting_issue_942(): +def test_pyi_formatting_issue_942(tmpdir): test_input = ('import os\n' '\n' '\n' 'def my_method():\n') + expected_py_output = test_input expected_pyi_output = ('import os\n' '\n' 'def my_method():\n') - assert SortImports(file_contents=test_input).output == test_input + assert SortImports(file_contents=test_input).output == expected_py_output assert SortImports(file_contents=test_input, extension="pyi").output == expected_pyi_output + + source_py = tmpdir.join('source.py') + source_py.write(test_input) + assert SortImports(file_path=str(source_py)).output == expected_py_output + + source_pyi = tmpdir.join('source.pyi') + source_pyi.write(test_input) + assert SortImports(file_path=str(source_pyi)).output == expected_pyi_output |