diff options
| author | ymdatta <ymdatta@protonmail.com> | 2018-11-09 08:39:47 +0530 |
|---|---|---|
| committer | ymdatta <ymdatta@protonmail.com> | 2018-11-09 08:39:47 +0530 |
| commit | 3b161305003448f67e5f9c4847ff196e8d2ac716 (patch) | |
| tree | eb9d76b682cb547164223c9798b7a33737969c44 /tests/unit | |
| parent | ccd9beb26dac68ada62d3c5fd58c0e4ffa3d79c3 (diff) | |
| download | flake8-3b161305003448f67e5f9c4847ff196e8d2ac716.tar.gz | |
test_option:Modify the tests to check support for optparse's types.
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_option.py | 12 |
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') |
