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"))
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)
def test_start_game_pass(self): user_input = ['2', 'n'] with patch('builtins.input', side_effect=user_input): rps_game.RPSGame().start_game()
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)