diff options
author | Timothy Edmund Crosley <timothy.crosley@gmail.com> | 2013-12-09 09:01:10 -0800 |
---|---|---|
committer | Timothy Edmund Crosley <timothy.crosley@gmail.com> | 2013-12-09 09:01:10 -0800 |
commit | d24146c52cc8b0a9fe1b6d418c333f2776213425 (patch) | |
tree | c972543f186370e57bd878ab6452153b906a2673 | |
parent | e01e5825d56a439a80581e63bf3e067bf03ae87b (diff) | |
parent | 2f58b0e5231c8f4ef8d5a536d296d2427cda152a (diff) | |
download | isort-feature/commented-sections.tar.gz |
Merge pull request #88 from timothycrosley/feature/fix-issue-87feature/commented-sections
Feature/fix issue 87
-rw-r--r-- | isort/isort.py | 2 | ||||
-rw-r--r-- | test_isort.py | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/isort/isort.py b/isort/isort.py index e1e78420..fc6f9fb2 100644 --- a/isort/isort.py +++ b/isort/isort.py @@ -289,7 +289,7 @@ class SortImports(object): @staticmethod def _output_hanging_indent(statement, imports, white_space, indent, line_length): - statement += " " + imports.pop(0) + statement += imports.pop(0) while imports: next_import = imports.pop(0) next_statement = statement + ", " + next_import diff --git a/test_isort.py b/test_isort.py index f90b3ea4..7b504ff5 100644 --- a/test_isort.py +++ b/test_isort.py @@ -184,7 +184,7 @@ def test_output_modes(): test_output_hanging_indent = SortImports(file_contents=REALLY_LONG_IMPORT, multi_line_output=WrapModes.HANGING_INDENT, line_length=40, indent=" ").output - assert test_output_hanging_indent == ("from third_party import lib1, lib2, \\\n" + assert test_output_hanging_indent == ("from third_party import lib1, lib2, \\\n" " lib3, lib4, lib5, lib6, lib7, \\\n" " lib8, lib9, lib10, lib11, lib12, \\\n" " lib13, lib14, lib15, lib16, lib17, \\\n" @@ -256,7 +256,7 @@ def test_convert_hanging(): """ Ensure that isort will convert hanging indents to correct indent method. """ - test_input = ("from third_party import lib1, lib2, \\\n" + test_input = ("from third_party import lib1, lib2, \\\n" " lib3, lib4, lib5, lib6, lib7, \\\n" " lib8, lib9, lib10, lib11, lib12, \\\n" " lib13, lib14, lib15, lib16, lib17, \\\n" @@ -282,7 +282,7 @@ def test_custom_indent(): """ test_output = SortImports(file_contents=REALLY_LONG_IMPORT, multi_line_output=WrapModes.HANGING_INDENT, line_length=40, indent=" ").output - assert test_output == ("from third_party import lib1, lib2, \\\n" + assert test_output == ("from third_party import lib1, lib2, \\\n" " lib3, lib4, lib5, lib6, lib7, lib8, \\\n" " lib9, lib10, lib11, lib12, lib13, \\\n" " lib14, lib15, lib16, lib17, lib18, \\\n" @@ -290,7 +290,7 @@ def test_custom_indent(): test_output = SortImports(file_contents=REALLY_LONG_IMPORT, multi_line_output=WrapModes.HANGING_INDENT, line_length=40, indent="' '").output - assert test_output == ("from third_party import lib1, lib2, \\\n" + assert test_output == ("from third_party import lib1, lib2, \\\n" " lib3, lib4, lib5, lib6, lib7, lib8, \\\n" " lib9, lib10, lib11, lib12, lib13, \\\n" " lib14, lib15, lib16, lib17, lib18, \\\n" @@ -298,7 +298,7 @@ def test_custom_indent(): test_output = SortImports(file_contents=REALLY_LONG_IMPORT, multi_line_output=WrapModes.HANGING_INDENT, line_length=40, indent="tab").output - assert test_output == ("from third_party import lib1, lib2, \\\n" + assert test_output == ("from third_party import lib1, lib2, \\\n" "\tlib3, lib4, lib5, lib6, lib7, lib8, \\\n" "\tlib9, lib10, lib11, lib12, lib13, \\\n" "\tlib14, lib15, lib16, lib17, lib18, \\\n" @@ -306,7 +306,7 @@ def test_custom_indent(): test_output = SortImports(file_contents=REALLY_LONG_IMPORT, multi_line_output=WrapModes.HANGING_INDENT, line_length=40, indent=2).output - assert test_output == ("from third_party import lib1, lib2, \\\n" + assert test_output == ("from third_party import lib1, lib2, \\\n" " lib3, lib4, lib5, lib6, lib7, lib8, \\\n" " lib9, lib10, lib11, lib12, lib13, \\\n" " lib14, lib15, lib16, lib17, lib18, \\\n" @@ -524,7 +524,7 @@ def test_force_single_line_imports(): """ Test to ensure forcing imports to each have their own line works as expected. """ - test_input = ("from third_party import lib1, lib2, \\\n" + test_input = ("from third_party import lib1, lib2, \\\n" " lib3, lib4, lib5, lib6, lib7, \\\n" " lib8, lib9, lib10, lib11, lib12, \\\n" " lib13, lib14, lib15, lib16, lib17, \\\n" |