diff options
Diffstat (limited to 'test_isort.py')
-rw-r--r-- | test_isort.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test_isort.py b/test_isort.py index 41458991..574f201e 100644 --- a/test_isort.py +++ b/test_isort.py @@ -22,7 +22,7 @@ OTHER DEALINGS IN THE SOFTWARE. """ from __future__ import absolute_import, division, print_function, unicode_literals -from pies.overrides import * +from isort.pie_slice import * from isort.isort import SortImports from isort.settings import WrapModes @@ -413,6 +413,18 @@ def test_custom_indent(): " lib20, lib21, lib22\n") +def test_use_parentheses(): + test_input = ( + "from fooooooooooooooooooooooooo.baaaaaaaaaaaaaaaaaaarrrrrrr import \\" + " my_custom_function as my_special_function" + ) + test_output = SortImports( + file_contents=test_input, known_third_party=['django'], + line_length=79, use_parentheses=True, + ).output + assert '(' in test_output + + def test_skip(): """Ensure skipping a single import will work as expected.""" test_input = ("import myproject\n" @@ -1397,3 +1409,16 @@ def test_fcntl(): "import os\n" "import sys\n") assert SortImports(file_contents=test_input).output == test_input + + +def test_import_split_is_word_boundary_aware(): + """Test to ensure that isort splits words in a boundry aware mannor""" + test_input = ("from mycompany.model.size_value_array_import_func import (" + " get_size_value_array_import_func_jobs," + ")") + test_output = SortImports(file_contents=test_input, + multi_line_output=WrapModes.VERTICAL_HANGING_INDENT, + line_length=79).output + + assert test_output == ("from mycompany.model.size_value_array_import_func import \\\n" + " get_size_value_array_import_func_jobs\n") |