summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_option.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/test_option.py b/tests/unit/test_option.py
index 76b4341..eb4f95d 100644
--- a/tests/unit/test_option.py
+++ b/tests/unit/test_option.py
@@ -23,6 +23,16 @@ def test_to_optparse():
assert optparse_opt.action == 'count'
+@pytest.mark.parametrize('opttype,str_val,expected', [
+ ('float', '2', 2.0),
+ ('complex', '2', (2 + 0j)),
+])
+def test_to_support_optparses_standard_types(opttype, str_val, expected):
+ """Show that optparse converts float and complex types correctly."""
+ opt = manager.Option('-t', '--test', type=opttype)
+ assert opt.normalize_from_setuptools(str_val) == expected
+
+
@mock.patch('optparse.Option')
def test_to_optparse_creates_an_option_as_we_expect(Option): # noqa: N803
"""Show that we pass all keyword args to optparse.Option."""