Ejemplo n.º 1
0
    def test_parse_separates_args(self):
        command = Command(run=function)
        command.add_argument(Arg('simple', required=True))

        args, kwargs = command.parse(['simple'])

        self.assertIn('simple', args)
Ejemplo n.º 2
0
    def test_parse_separates_kwargs(self):
        command = Command(run=function)
        command.add_argument(Arg('keyword1', required=False, default=0))

        args, kwargs = command.parse(['simple'])

        self.assertIn('keyword1', kwargs)
Ejemplo n.º 3
0
 def test_had_argument(self):
     command = Command(run=lambda new_argument: new_argument)
     self.assertEqual(len(command.args), 1)
     arg = Arg('new_argument', help='argument help')
     command.add_argument(arg)
     self.assertEqual(len(command.args), 1)
     self.assertEqual(command.args[0].help,
         'argument help')