mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-02 03:46:53 +00:00
remove log_token and EXTRA_VERBOSE
- flake8 spent 5% of execution in `log_token` - `EXTRA_VERBOSE` was only used by `log_token` - `python -m tokenize` provides better debug token output
This commit is contained in:
parent
5ecea41b6d
commit
929cf5dfd3
6 changed files with 2 additions and 73 deletions
|
|
@ -10,7 +10,7 @@ def options_from(**kwargs):
|
|||
kwargs.setdefault("max_line_length", 79)
|
||||
kwargs.setdefault("max_doc_length", None)
|
||||
kwargs.setdefault("indent_size", 4)
|
||||
kwargs.setdefault("verbose", False)
|
||||
kwargs.setdefault("verbose", 0)
|
||||
kwargs.setdefault("stdin_display_name", "stdin")
|
||||
kwargs.setdefault("disable_noqa", False)
|
||||
return argparse.Namespace(**kwargs)
|
||||
|
|
|
|||
|
|
@ -380,51 +380,6 @@ def test_expand_indent(string, expected):
|
|||
assert expected == actual
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"token, log_string",
|
||||
[
|
||||
[
|
||||
(
|
||||
tokenize.COMMENT,
|
||||
"# this is a comment",
|
||||
(1, 0), # (start_row, start_column)
|
||||
(1, 19), # (end_ro, end_column)
|
||||
"# this is a comment",
|
||||
),
|
||||
"l.1\t[:19]\tCOMMENT\t'# this is a comment'",
|
||||
],
|
||||
[
|
||||
(
|
||||
tokenize.COMMENT,
|
||||
"# this is a comment",
|
||||
(1, 5), # (start_row, start_column)
|
||||
(1, 19), # (end_ro, end_column)
|
||||
"# this is a comment",
|
||||
),
|
||||
"l.1\t[5:19]\tCOMMENT\t'# this is a comment'",
|
||||
],
|
||||
[
|
||||
(
|
||||
tokenize.COMMENT,
|
||||
"# this is a comment",
|
||||
(1, 0), # (start_row, start_column)
|
||||
(2, 19), # (end_ro, end_column)
|
||||
"# this is a comment",
|
||||
),
|
||||
"l.1\tl.2\tCOMMENT\t'# this is a comment'",
|
||||
],
|
||||
],
|
||||
)
|
||||
def test_log_token(token, log_string):
|
||||
"""Verify we use the log object passed in."""
|
||||
log = mock.Mock()
|
||||
processor.log_token(log, token)
|
||||
log.log.assert_called_once_with(
|
||||
5, # flake8._EXTRA_VERBOSE
|
||||
log_string,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"current_count, token_text, expected",
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue