From 3b490bb3c5775fedca7167a98c5bf4aee5e171f7 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 24 Apr 2020 10:43:54 -0700 Subject: [PATCH] Fix type='str' optparse options --- src/flake8/options/manager.py | 2 ++ tests/unit/test_option_manager.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/flake8/options/manager.py b/src/flake8/options/manager.py index 13c7969..d076862 100644 --- a/src/flake8/options/manager.py +++ b/src/flake8/options/manager.py @@ -28,6 +28,8 @@ _optparse_callable_map = { "float": float, "complex": complex, "choice": _ARG.NO, + # optparse allows this but does not document it + "str": str, } # type: Dict[str, Union[Type[Any], _ARG]] diff --git a/tests/unit/test_option_manager.py b/tests/unit/test_option_manager.py index b97a9a6..f2ee4f9 100644 --- a/tests/unit/test_option_manager.py +++ b/tests/unit/test_option_manager.py @@ -303,6 +303,8 @@ def test_optparse_normalize_callback_option_legacy(optmanager): ('string', 'foo', 'foo'), ('float', '1.5', 1.5), ('complex', '1+5j', 1 + 5j), + # optparse allows this but does not document it + ('str', 'foo', 'foo'), ), ) def test_optparse_normalize_types(optmanager, type_s, input_val, expected):