Exemplo n.º 1
0
 def test_evaluate_result(self):
     self.assertTrue(rps_game.RPSGame().evaluate_result("1", "1"))
     self.assertTrue(rps_game.RPSGame().evaluate_result("1", "3"))
     self.assertTrue(rps_game.RPSGame().evaluate_result("2", "3"))
Exemplo n.º 2
0
 def test_input_validation_fail(self):
     user_input = ['3']
     with patch('builtins.input', side_effect=user_input):
         with self.assertRaises(SystemExit) as cm:
             rps_game.RPSGame().input_validation()
         self.assertEqual(cm.exception.code, -1)
Exemplo n.º 3
0
 def test_start_game_pass(self):
     user_input = ['2', 'n']
     with patch('builtins.input', side_effect=user_input):
         rps_game.RPSGame().start_game()
Exemplo n.º 4
0
 def test_input_validation_pass3(self):
     user_input = ['1', 'xxx', '3', 'Y', '1', 'mozhi', '2', 'n']
     with patch('builtins.input', side_effect=user_input):
         with self.assertRaises(SystemExit) as cm:
             rps_game.RPSGame().input_validation()
         self.assertEqual(cm.exception.code, 0)