Ejemplo n.º 1
0
def merge(arg, default, override, args, kwargs):
    '''Merge all the possible arguments into a tuple and a dictionary.

    :param arg: The argument's name.
    :param default: The argument's default value or an instance of _POSITIONAL.
    :param override: A tuple containing (args, kwargs) given to @arg.
    :param args: The arguments extracted from the docstring.
    :param kwargs: The keyword arguments extracted from the docstring.'''
    opts = [arg]
    if not isinstance(default, _POSITIONAL):
        opts = list(ensure_dashes(args or opts))
        kwargs.update({'default': default, 'dest': arg})
        kwargs.update(action_by_type(default))
    else:
        # positionals can't have a metavar, otherwise the help is screwed
        # if one really wants the metavar, it can be added with @arg
        kwargs['metavar'] = None
    kwargs.update(override[1])
    return override[0] or opts, kwargs
Ejemplo n.º 2
0
 def testFunc(self):
     self.assertEqual(self.result, action_by_type(self.obj))
Ejemplo n.º 3
0
def test_action_by_type(obj, result):
        assert result == action_by_type(obj)
Ejemplo n.º 4
0
 def testFunc(self):
     self.assertEqual(self.result, action_by_type(self.obj))
Ejemplo n.º 5
0
def test_action_by_type(obj, result):
    assert result == action_by_type(obj)