mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-07 05:26:53 +00:00
Type annotate flake8.options.manager
This commit is contained in:
parent
8cd1e0ecc7
commit
8c4e42afaa
8 changed files with 142 additions and 115 deletions
|
|
@ -28,7 +28,7 @@ def test_to_argparse():
|
|||
def test_to_optparse():
|
||||
"""Test that .to_optparse() produces a useful error message."""
|
||||
with pytest.raises(AttributeError) as excinfo:
|
||||
manager.Option('--foo').to_optparse()
|
||||
manager.Option('--foo').to_optparse
|
||||
msg, = excinfo.value.args
|
||||
assert msg == 'to_optparse: flake8 now uses argparse'
|
||||
|
||||
|
|
@ -58,4 +58,4 @@ def test_config_name_needs_long_option_name():
|
|||
def test_dest_is_not_overridden():
|
||||
"""Show that we do not override custom destinations."""
|
||||
opt = manager.Option('-s', '--short', dest='something_not_short')
|
||||
assert opt.dest == 'something_not_short' # type: ignore
|
||||
assert opt.dest == 'something_not_short'
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ def test_add_option_long_option_only(optmanager):
|
|||
assert optmanager.config_options_dict == {}
|
||||
|
||||
optmanager.add_option('--long', help='Test long opt')
|
||||
assert optmanager.options[0].short_option_name is manager._NOARG
|
||||
assert optmanager.options[0].short_option_name is manager._ARG.NO
|
||||
assert optmanager.options[0].long_option_name == '--long'
|
||||
|
||||
|
||||
|
|
@ -133,15 +133,6 @@ def test_parse_args_normalize_paths(optmanager):
|
|||
]
|
||||
|
||||
|
||||
def test_format_plugin():
|
||||
"""Verify that format_plugin turns a tuple into a dictionary."""
|
||||
plugin = manager.OptionManager.format_plugin(
|
||||
manager.PluginVersion('Testing', '0.0.0', False)
|
||||
)
|
||||
assert plugin['name'] == 'Testing'
|
||||
assert plugin['version'] == '0.0.0'
|
||||
|
||||
|
||||
def test_generate_versions(optmanager):
|
||||
"""Verify a comma-separated string is generated of registered plugins."""
|
||||
optmanager.registered_plugins = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue