diff --git a/src/flake8/utils.py b/src/flake8/utils.py index 619c83d..92fec71 100644 --- a/src/flake8/utils.py +++ b/src/flake8/utils.py @@ -24,7 +24,7 @@ string_types = (str, type(u"")) def parse_comma_separated_list(value, regexp=COMMA_SEPARATED_LIST_RE): - # type: (Optional[str], Pattern[str]) -> List[str] + # type: (str, Pattern[str]) -> List[str] """Parse a comma-separated list. :param value: @@ -41,9 +41,6 @@ def parse_comma_separated_list(value, regexp=COMMA_SEPARATED_LIST_RE): """ assert isinstance(value, string_types), value # nosec (for bandit) - if not value: - return [] - separated = regexp.split(value) item_gen = (item.strip() for item in separated) return [item for item in item_gen if item] diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 9fd03b2..151a76d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -22,6 +22,7 @@ RELATIVE_PATHS = ["flake8", "pep8", "pyflakes", "mccabe"] ("E123,W234,,E206,,", ["E123", "W234", "E206"]), ("E123, W234,, E206,,", ["E123", "W234", "E206"]), ("E123,,W234,,E206,,", ["E123", "W234", "E206"]), + ("", []), ]) def test_parse_comma_separated_list(value, expected): """Verify that similar inputs produce identical outputs."""