mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
Add more tests around the processor module
This commit is contained in:
parent
4ea161ff9c
commit
425f89eee9
2 changed files with 49 additions and 2 deletions
|
|
@ -370,6 +370,8 @@ def log_token(log, token):
|
|||
token[1]))
|
||||
|
||||
|
||||
# NOTE(sigmavirus24): This was taken wholesale from
|
||||
# https://github.com/PyCQA/pycodestyle
|
||||
def expand_indent(line):
|
||||
r"""Return the amount of indentation.
|
||||
|
||||
|
|
@ -397,6 +399,9 @@ def expand_indent(line):
|
|||
return result
|
||||
|
||||
|
||||
# NOTE(sigmavirus24): This was taken wholesale from
|
||||
# https://github.com/PyCQA/pycodestyle. The in-line comments were edited to be
|
||||
# more descriptive.
|
||||
def mutate_string(text):
|
||||
"""Replace contents with 'xxx' to prevent syntax matching.
|
||||
|
||||
|
|
@ -407,10 +412,12 @@ def mutate_string(text):
|
|||
>>> mute_string("r'abc'")
|
||||
"r'xxx'"
|
||||
"""
|
||||
# String modifiers (e.g. u or r)
|
||||
# NOTE(sigmavirus24): If there are string modifiers (e.g., b, u, r)
|
||||
# use the last "character" to determine if we're using single or double
|
||||
# quotes and then find the first instance of it
|
||||
start = text.index(text[-1]) + 1
|
||||
end = len(text) - 1
|
||||
# Triple quotes
|
||||
# Check for triple-quoted strings
|
||||
if text[-3:] in ('"""', "'''"):
|
||||
start += 2
|
||||
end -= 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue