summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2019-09-24 13:53:04 -0700
committerAnthony Sottile <asottile@umich.edu>2019-09-24 13:54:32 -0700
commitfdcec2803a3d2e340b109996c62a7af898e87a99 (patch)
treec907fae32e7739c1c7f705bc8715f373e97338e2 /tests
parent121ea4f056fabc82d870cf5deaaf37f035be6d10 (diff)
downloadflake8-fdcec2803a3d2e340b109996c62a7af898e87a99.tar.gz
Don't reset indent_char when we encounter E101
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_main.py19
-rw-r--r--tests/unit/test_file_processor.py18
2 files changed, 19 insertions, 18 deletions
diff --git a/tests/integration/test_main.py b/tests/integration/test_main.py
index 72e9621..ea9355d 100644
--- a/tests/integration/test_main.py
+++ b/tests/integration/test_main.py
@@ -51,6 +51,25 @@ index d64ac39..7d943de 100644
assert err == ''
+def test_e101_indent_char_does_not_reset(tmpdir, capsys):
+ """Ensure that E101 with an existing indent_char does not reset it."""
+ t_py_contents = """\
+if True:
+ print('space indented')
+
+s = '''\
+\ttab indented
+''' # noqa: E101
+
+if True:
+ print('space indented')
+"""
+
+ with tmpdir.as_cwd():
+ tmpdir.join('t.py').write(t_py_contents)
+ _call_main(['t.py'])
+
+
def test_statistics_option(tmpdir, capsys):
"""Ensure that `flake8 --statistics` works."""
with tmpdir.as_cwd():
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py
index c3ae021..afae77d 100644
--- a/tests/unit/test_file_processor.py
+++ b/tests/unit/test_file_processor.py
@@ -146,24 +146,6 @@ def test_next_line(default_options):
assert file_processor.line_number == i
-@pytest.mark.parametrize('error_code, line, expected_indent_char', [
- ('E101', '\t\ta = 1', '\t'),
- ('E101', ' a = 1', ' '),
- ('W101', 'frobulate()', None),
- ('F821', 'class FizBuz:', None),
-])
-def test_check_physical_error(
- error_code, line, expected_indent_char, default_options,
-):
- """Verify we update the indet char for the appropriate error code."""
- file_processor = processor.FileProcessor('-', default_options, lines=[
- 'Line 1',
- ])
-
- file_processor.check_physical_error(error_code, line)
- assert file_processor.indent_char == expected_indent_char
-
-
@pytest.mark.parametrize('params, args, expected_kwargs', [
({'blank_before': True, 'blank_lines': True},
None,