mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-31 11:16:54 +00:00
Merge branch 'bug/330' into 'master'
Filter out empty ignore/select codes Closes #330 See merge request !184
This commit is contained in:
commit
24129d846c
2 changed files with 7 additions and 1 deletions
|
|
@ -29,7 +29,8 @@ def parse_comma_separated_list(value):
|
|||
if not isinstance(value, (list, tuple)):
|
||||
value = value.split(',')
|
||||
|
||||
return [item.strip() for item in value]
|
||||
item_gen = (item.strip() for item in value)
|
||||
return [item for item in item_gen if item]
|
||||
|
||||
|
||||
def normalize_paths(paths, parent=os.curdir):
|
||||
|
|
|
|||
|
|
@ -13,8 +13,13 @@ RELATIVE_PATHS = ["flake8", "pep8", "pyflakes", "mccabe"]
|
|||
@pytest.mark.parametrize("value,expected", [
|
||||
("E123,\n\tW234,\n E206", ["E123", "W234", "E206"]),
|
||||
("E123,W234,E206", ["E123", "W234", "E206"]),
|
||||
("E123,W234,E206,", ["E123", "W234", "E206"]),
|
||||
("E123,W234,,E206,,", ["E123", "W234", "E206"]),
|
||||
("E123,,W234,,E206,,", ["E123", "W234", "E206"]),
|
||||
(["E123", "W234", "E206"], ["E123", "W234", "E206"]),
|
||||
(["E123", "\n\tW234", "\n E206"], ["E123", "W234", "E206"]),
|
||||
(["E123", "\n\tW234", "\n E206", "\n"], ["E123", "W234", "E206"]),
|
||||
(["E123", "\n\tW234", "", "\n E206", "\n"], ["E123", "W234", "E206"]),
|
||||
])
|
||||
def test_parse_comma_separated_list(value, expected):
|
||||
"""Verify that similar inputs produce identical outputs."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue