diff options
author | Ian Stapleton Cordasco <graffatcolmingov@gmail.com> | 2020-11-19 14:06:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-19 14:06:38 -0600 |
commit | 9dd78b97dea0e943300c92c853d6869e7fe41299 (patch) | |
tree | c5eda48ab614b299e79eaffb9eca07c00cb40087 /testsuite | |
parent | 07b113bdb43524181ec828a3b9da009a388c2161 (diff) | |
parent | c060b1c1f46b126a5f0c429701f30f2e7e800815 (diff) | |
download | pep8-9dd78b97dea0e943300c92c853d6869e7fe41299.tar.gz |
Merge pull request #970 from bukzor/multi-indent
Support for space indents with size other than 4
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/test_api.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/test_api.py b/testsuite/test_api.py index ad96074..ce2d33a 100644 --- a/testsuite/test_api.py +++ b/testsuite/test_api.py @@ -391,3 +391,52 @@ class APITestCase(unittest.TestCase): # TODO: runner # TODO: input_file + + def test_styleguides_other_indent_size(self): + pycodestyle.register_check(DummyChecker, ['Z701']) + lines = [ + 'def foo():\n', + ' pass\n', + '\n', + '\n', + 'def foo_correct():\n', + ' pass\n', + '\n', + '\n', + 'def bar():\n', + ' [1, 2, 3,\n', + ' 4, 5, 6,\n', + ' ]\n', + '\n', + '\n', + 'if (1 in [1, 2, 3]\n', + ' and bool(0) is False\n', + ' and bool(1) is True):\n', + ' pass\n' + ] + + pep8style = pycodestyle.StyleGuide() + pep8style.options.indent_size = 3 + count_errors = pep8style.input_file('stdin', lines=lines) + stdout = sys.stdout.getvalue() + self.assertEqual(count_errors, 4) + expected = ( + 'stdin:2:5: ' + 'E111 indentation is not a multiple of 3' + ) + self.assertTrue(expected in stdout) + expected = ( + 'stdin:11:6: ' + 'E127 continuation line over-indented for visual indent' + ) + self.assertTrue(expected in stdout) + expected = ( + 'stdin:12:6: ' + 'E124 closing bracket does not match visual indentation' + ) + self.assertTrue(expected in stdout) + expected = ( + 'stdin:17:6: ' + 'E127 continuation line over-indented for visual indent' + ) + self.assertTrue(expected in stdout) |