Exemplo n.º 1
0
 def test_valid_command_incorrect(self):
     command = "fkemrf"
     self.assertEqual(r.valid_command(command), False)
Exemplo n.º 2
0
 def test_valid_command_inrrect_order(self):
     command = "10 forward"
     self.assertEqual(r.valid_command(command), False)
Exemplo n.º 3
0
 def test_valid_command_incorrect_argument(self):
     command = "forward a"
     self.assertEqual(r.valid_command(command), False)
Exemplo n.º 4
0
 def test_valid_command_pass(self):
     self.assertEqual(robot.valid_command("forward 10"), True)
Exemplo n.º 5
0
 def test_valid_command_correct(self):
     command = "forward 5"
     self.assertEqual(r.valid_command(command), True)
Exemplo n.º 6
0
 def test_valid_commands_fail(self):
     self.assertEqual(robot.valid_command("jump up"), False)
Exemplo n.º 7
0
 def test_valid_commands_fail_no_number(self):
     self.assertEqual(robot.valid_command("forward"), False)
Exemplo n.º 8
0
 def test_valid_command_replay_reversed_silent(self):
     with captured_io(StringIO('replay silent')):
         self.assertEqual(robot.valid_command('replay reversed silent'),
                          True)
Exemplo n.º 9
0
 def test_valid_command_reversed_command(self):
     with captured_io(StringIO('5 forward')):
         self.assertEqual(robot.valid_command('5 forward'), False)
Exemplo n.º 10
0
 def test_valid_command_is_valid(self):
     with captured_io(StringIO('forward 5')):
         self.assertEqual(robot.valid_command('forward 5'), True)
Exemplo n.º 11
0
 def test_valid_command(self):
     with captured_io(StringIO("")):
         self.assertEqual(robot.valid_command("off"), True)
         self.assertEqual(robot.valid_command("help"), True)
         self.assertEqual(robot.valid_command("forward 10"), True)
         self.assertEqual(robot.valid_command("back 5"), True)
         self.assertEqual(robot.valid_command("right"), True)
         self.assertEqual(robot.valid_command("left"), True)
         self.assertEqual(robot.valid_command("sprint"), True)
         self.assertEqual(robot.valid_command("replay"), True)
         self.assertEqual(robot.valid_command("replay silent"), True)
         self.assertEqual(robot.valid_command("replay reversed"), True)
         self.assertEqual(robot.valid_command("replay reversed silent"),
                          True)
         self.assertEqual(robot.valid_command("hello"), False)
Exemplo n.º 12
0
 def test_valid_command(self):
     with patch("sys.stdout", new=StringIO()) as var:
         robot.valid_command("forward 10")
         output = var.getvalue().strip()
         self.assertEqual(output, """""")