Don't reset indent_char when we encounter E101

This commit is contained in:
Anthony Sottile 2019-09-24 13:53:04 -07:00
parent 121ea4f056
commit fdcec2803a
4 changed files with 20 additions and 28 deletions

View file

@ -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():

View file

@ -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,