summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <tcrosley@domaintools.com>2017-06-06 23:55:48 -0700
committerTimothy Crosley <tcrosley@domaintools.com>2017-06-06 23:55:48 -0700
commitd65d97e83e327e6cf0d0ea62ef005140d74b9a15 (patch)
tree6e83744bb26d0333dcc9348ef970a881a35052fb
parent546ffbf46cf0f1f2c202b6da442832258d7a6ec4 (diff)
parenta88e2a6e5d37f47063a9fb0f32db45a96b22979c (diff)
downloadisort-d65d97e83e327e6cf0d0ea62ef005140d74b9a15.tar.gz
Merge in latest
-rw-r--r--CHANGELOG.md5
-rw-r--r--isort/isort.py2
-rw-r--r--test_isort.py8
3 files changed, 14 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 41e38c7f..0080a429 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,11 @@ Changelog
- Breaking changes
- Python 2.7+ only (dropped 2.6) allowing various code simplifications and improvements.
-### 4.2.14 - June 2, 2017 - hotfix release
+### 4.2.15 - June 6, 2017 - hotfix release
IMPORTANT NOTE: This will be the last release with Python 2.6 support, subsequent releases will be 2.7+ only
+- Fixed certain one line imports not being successfully wrapped
+
+### 4.2.14 - June 5, 2017 - hotfix release
- Fixed #559 & #565: Added missing standard library imports
### 4.2.13 - June 2, 2017 - hotfix release
diff --git a/isort/isort.py b/isort/isort.py
index e0cddf76..8b1e5bd8 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -497,6 +497,8 @@ class SortImports(object):
new_import_statement = formatter(import_start, copy.copy(from_imports),
dynamic_indent, indent, line_length, comments)
lines = new_import_statement.split("\n")
+ if import_statement.count('\n') == 0:
+ return self._wrap(import_statement)
return import_statement
def _add_formatted_imports(self):
diff --git a/test_isort.py b/test_isort.py
index ec46b800..4cefa8b0 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -2149,3 +2149,11 @@ def test_no_extra_lines_issue_557():
'from scrapy.core.downloader.handlers.http import HttpDownloadHandler, HTTPDownloadHandler\n')
assert SortImports(file_contents=test_input, force_alphabetical_sort=True,
force_sort_within_sections=True).output == expected_output
+
+
+def test_long_import_wrap_support_with_mode_2():
+ """Test to ensure mode 2 still allows wrapped imports with slash"""
+ test_input = ('from foobar.foobar.foobar.foobar import \\\n'
+ ' an_even_longer_function_name_over_80_characters\n')
+ assert SortImports(file_contents=test_input, multi_line_output=2, line_length=80).output == test_input
+