def test_create_instance(self): self.poker_game = PokerGame_1.PokerGame("2D 3D AD 4D 5D") self.assertTrue(isinstance(self.poker_game, PokerGame_1.PokerGame))
def test_get_score_1(self): """测试得1分""" self.get_score = PokerGame_1.GetScore('2D 7C 4H AS 3S') self.assertEqual(self.get_score.get_score(), 1)
def test_is_high_card_7(self): """判断不是散牌""" self.get_score = PokerGame_1.JudgeTheResult("2D 2S 6C 9D 4D") self.assertFalse(self.get_score.is_high_card())
def test_get_score_5(self): """测试得5分""" self.get_score = PokerGame_1.GetScore('2D 4D 5D AD 3S') self.assertEqual(self.get_score.get_score(), 5)
def test_get_score_3(self): """测试得3分""" self.get_score = PokerGame_1.GetScore('2D 2C 2H 2S 3S') self.assertEqual(self.get_score.get_score(), 3)
def test_result_4(self): white = PokerGame_1.GetScore('2D 3H 5C 9S KH') black = PokerGame_1.GetScore('2H 3D 5S 9C KD') result = PokerGame_1.TexasHoldEmPoker.result(white, black) self.assertEqual(result, 'Tie')
def test_result_1(self): white = PokerGame_1.GetScore('2C 3H 4S 8C AH') black = PokerGame_1.GetScore('2H 3D 5S 9C KD') result = PokerGame_1.TexasHoldEmPoker.result(white, black) self.assertEqual(result, 'White wins')
def test_is_straight_flush_2(self): """判断是同花顺""" self.get_score = PokerGame_1.JudgeTheResult("2D 3D AD 5D 4D") self.assertTrue(self.get_score.is_straight_flush())
def test_is_straight_flush_3(self): """判断是同花顺""" self.get_score = PokerGame_1.JudgeTheResult("8D JD 9D QD TD") self.assertTrue(self.get_score.is_straight_flush())
def test_is_straight_3(self): """判断是顺子""" self.get_score = PokerGame_1.JudgeTheResult("2D 4D 5D AD 3D") self.assertTrue(self.get_score.is_straight())
def test_is_straight_flush(self): """判断不是同花顺""" self.get_score = PokerGame_1.JudgeTheResult("2D 3D AD 5D 4S") self.assertFalse(self.get_score.is_straight_flush())
def test_is_straight_2(self): """判断是顺子""" self.get_score = PokerGame_1.JudgeTheResult("TD QD JD AD KD") self.assertTrue(self.get_score.is_straight())
def test_is_straight(self): """判断不是顺子""" self.get_score = PokerGame_1.JudgeTheResult("4S 3D AD 4D 5D") self.assertFalse(self.get_score.is_straight())
def test_is_flush_3(self): """判断不是同花""" self.get_score = PokerGame_1.JudgeTheResult("2D AS 7D 9D JD") self.assertFalse(self.get_score.is_flush())
def test_result_2(self): white = PokerGame_1.GetScore('2S 8S AS QS 3S') black = PokerGame_1.GetScore('2H 4S 4C 2D 4H') result = PokerGame_1.TexasHoldEmPoker.result(white, black) self.assertEqual(result, 'White wins')
def test_is_flush(self): """判断是同花""" self.get_score = PokerGame_1.JudgeTheResult("2D 6D 7D 9D 5D") self.assertTrue(self.get_score.is_flush())
def test_result_3(self): white = PokerGame_1.GetScore('2C 3H 4S 5C 6H') black = PokerGame_1.GetScore('2H 3H 5H 9H KH') result = PokerGame_1.TexasHoldEmPoker.result(white, black) self.assertEqual(result, 'Black wins')
def test_is_three_of_a_kind_3(self): """判断不是三张""" self.get_score = PokerGame_1.JudgeTheResult("2D 2H 2S 2C 3S") self.assertFalse(isinstance(self.get_score.is_three_of_a_kind(), str))
def test_result_5(self): white = PokerGame_1.GetScore('2D 2H 5C 5S KH') black = PokerGame_1.GetScore('3H 3D 5H 5D KD') result = PokerGame_1.TexasHoldEmPoker.result(white, black) self.assertEqual(result, 'Black wins')
def test_is_three_of_a_kind_4(self): """判断是三张""" self.get_score = PokerGame_1.JudgeTheResult("2D 2H 2S 3D 3S") self.assertTrue(isinstance(self.get_score.is_three_of_a_kind(), str))
def test_get_score_7(self): """测试得7分""" self.get_score = PokerGame_1.GetScore('2D 3D AD 5D 4D') self.assertEqual(self.get_score.get_score(), 7)
def test_is_two_pairs_2(self): """判断是两对""" self.get_score = PokerGame_1.JudgeTheResult("2D 2C 2H 2S 3S") self.assertTrue(isinstance(self.get_score.is_two_pairs(), list))
def test_get_score_4(self): """测试得4分""" self.get_score = PokerGame_1.GetScore('2D 2H 2S 3D 3S') self.assertEqual(self.get_score.get_score(), 4)
def test_is_one_pairs_3(self): """判断不是一对""" self.get_score = PokerGame_1.JudgeTheResult("2D 2C 2H 2S 3S") self.assertFalse(isinstance(self.get_score.is_one_pairs(), str))
def test_get_score_2(self): """测试得2分""" self.get_score = PokerGame_1.GetScore('2D 2C 4H 7S 3S') self.assertEqual(self.get_score.get_score(), 2)
def test_is_one_pairs_4(self): """判断是一对""" self.get_score = PokerGame_1.JudgeTheResult("2D 8C 8H 5S 3S") self.assertTrue(isinstance(self.get_score.is_one_pairs(), str))
def test_get_score_6(self): """测试得6分""" self.get_score = PokerGame_1.GetScore('2D 6D 7D 9D 5D') self.assertEqual(self.get_score.get_score(), 6)
def test_is_high_card(self): """判断是散牌""" self.get_score = PokerGame_1.JudgeTheResult("2D 7C 4H AS 3S") self.assertTrue(self.get_score.is_high_card())