示例#1
0
 def test_command_with_difficult_params(self):
     program = CommandLine()
     program.parse_command_line('add "param_param_123_1"')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param_param_123_1')
示例#2
0
 def test_command_with_params(self):
     program = CommandLine()
     program.parse_command_line('add param')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param')
示例#3
0
 def test_command_with_params_and_key_optional_params_without_params(self):
     program = CommandLine()
     program.parse_command_line('add param -n')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params and key')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param')
     self.assertEqual(state['key'], '-n')
示例#4
0
 def test_command_with_params_and_key_with_difficult_params(self):
     program = CommandLine()
     program.parse_command_line('add param -a "key_param_123_1"')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params and key with params')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param')
     self.assertEqual(state['key'], '-a')
     self.assertEqual(state['key_params'], 'key_param_123_1')
示例#5
0
 def test_empty(self):
     program = CommandLine()
     program.parse_command_line('')
     state = program.get_state()
     self.assertEqual(state['state'], 'empty state')
示例#6
0
 def test_command(self):
     program = CommandLine()
     program.parse_command_line('add')
     state = program.get_state()
     self.assertEqual(state['state'], 'command')
     self.assertEqual(state['command'], 'add')