summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/unit/test_option.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/unit/test_option.py b/tests/unit/test_option.py
index 7c90512..1cb9dae 100644
--- a/tests/unit/test_option.py
+++ b/tests/unit/test_option.py
@@ -23,12 +23,14 @@ def test_to_optparse():
assert optparse_opt.action == 'count'
-def test_to_support_optparses_standard_types():
+@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')
-
- assert type(opt.normalize_from_setuptools(float(2))) == float
- assert type(opt.normalize_from_setuptools(complex(2))) == complex
+ opt = manager.Option('-t', '--test', type=opttype)
+ assert opt.normalize_from_setuptools(str_val) == expected
@mock.patch('optparse.Option')