summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-03-10 22:14:20 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-03-10 22:14:20 -0700
commitdd1152f1ce449f4785fcbd05bbec92943c90cefb (patch)
treee4bfdfa3e5175588a4f4380ae49e77462a03eada
parent45d5ca342ce2c8009a5d90007f3b132c87304a94 (diff)
parent211082d1f2b2be1052a1234e2cefef2bcaca51d5 (diff)
downloadisort-dd1152f1ce449f4785fcbd05bbec92943c90cefb.tar.gz
Merge branch 'master' of https://github.com/timothycrosley/isort
-rw-r--r--CHANGELOG.md2
-rw-r--r--isort/isort.py4
-rw-r--r--test_isort.py13
3 files changed, 17 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 66e88cc1..85638132 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@ Changelog
=========
### 4.3.15 - March 10, 2019 - hot fix release
- Fixed a regression with handling streaming input from pipes (Issue #895)
+- Fixed handling of \x0c whitespace character (Issue #811)
+- Improved CLI documentation
### 4.3.14 - March 9, 2019 - hot fix release
- Fixed a regression with */directory/*.py style patterns
diff --git a/isort/isort.py b/isort/isort.py
index ac21230f..adc64ab3 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -223,8 +223,8 @@ class SortImports(object):
check_output = self.output
check_against = file_contents
if self.config['ignore_whitespace']:
- check_output = check_output.replace(self.line_separator, "").replace(" ", "")
- check_against = check_against.replace(self.line_separator, "").replace(" ", "")
+ check_output = check_output.replace(self.line_separator, "").replace(" ", "").replace("\x0c", "")
+ check_against = check_against.replace(self.line_separator, "").replace(" ", "").replace("\x0c", "")
if check_output.strip() == check_against.strip():
if self.config['verbose']:
diff --git a/test_isort.py b/test_isort.py
index 58d27d17..8c157c4e 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -2875,3 +2875,16 @@ def test_to_ensure_empty_line_not_added_to_file_start_issue_889():
'# comment2\n'
'import sys\n')
assert SortImports(file_contents=test_input).output == test_input
+
+
+def test_to_ensure_correctly_handling_of_whitespace_only_issue_811(capsys):
+ test_input = ('import os\n'
+ 'import sys\n'
+ '\n'
+ '\x0c\n'
+ 'def my_function():\n'
+ ' print("hi")\n')
+ SortImports(file_contents=test_input, ignore_whitespace=True)
+ out, err = capsys.readouterr()
+ assert out == ''
+ assert err == ''