本文整理汇总了Python中hand.Hand.from_string方法的典型用法代码示例。如果您正苦于以下问题:Python Hand.from_string方法的具体用法?Python Hand.from_string怎么用?Python Hand.from_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hand.Hand
的用法示例。
在下文中一共展示了Hand.from_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_less_than_5_cards_should_raise_exception
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_less_than_5_cards_should_raise_exception(self):
with self.assertRaises(Exception) as cm:
Hand.from_string('4D 4D')
self.assertEquals(cm.exception.message, '2 cards in the hand, must be 5')
with self.assertRaises(Exception) as cm:
Hand.from_string('4D 4D 4D 4D 4D 4D 4D 4D')
self.assertEquals(cm.exception.message, '8 cards in the hand, must be 5')
示例2: test_when_hands_are_equals_numbers_should_tie
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_when_hands_are_equals_numbers_should_tie(self):
hand1 = Hand.from_string('4D 4D 4C 5D 5D')
hand2 = Hand.from_string('4D 4D 4C 5D 5D')
self.assertTrue(hand1 == hand2)
hand1 = Hand.from_string('TD TD TC TC KS')
hand2 = Hand.from_string('TS TS TH TH KS')
self.assertTrue(hand1 == hand2)
示例3: test_hand_with_one_pair_should_return_ONE_PAIR_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_one_pair_should_return_ONE_PAIR_as_value(self):
hand = Hand.from_string('4D 4D 2D 7H KD')
self.assertEquals(hand.value, 'ONE_PAIR')
示例4: test_when_no_combination_high_card_should_win
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_when_no_combination_high_card_should_win(self):
winner_hand = Hand.from_string('4D 5D 3D 7H KD')
looser_hand = Hand.from_string('4D 5D 3D 7H TD')
self.assertTrue(winner_hand > looser_hand)
示例5: test_hand_with_a_high_card_should_return_HIGH_CARD_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_a_high_card_should_return_HIGH_CARD_as_value(self):
hand = Hand.from_string('4D 5D 3D 7H KD')
self.assertEquals(hand.value, 'HIGH_CARD')
示例6: test_hand_with_high_sequence_numbers_and_the_same_suits_should_return_ROYAL_FLUSH_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_high_sequence_numbers_and_the_same_suits_should_return_ROYAL_FLUSH_as_value(self):
hand = Hand.from_string('TS JS QS KS AS')
self.assertEquals(hand.value, 'ROYAL_FLUSH')
示例7: test_royal_flush_should_win_to_straight
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_royal_flush_should_win_to_straight(self):
royal_flush = Hand.from_string('TS JS QS KS AS')
straight = Hand.from_string('AS 2S 3D 4S 5D')
self.assertTrue(royal_flush > straight)
示例8: test_hand_with_same_three_cards_and_a_pair_should_return_FULL_HOUSE_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_same_three_cards_and_a_pair_should_return_FULL_HOUSE_as_value(self):
hand = Hand.from_string('4D 4D 4C 3D 3D')
self.assertEquals(hand.value, 'FULL_HOUSE')
示例9: test_hand_with_sequence_numbers_should_return_STRAIGHT_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_sequence_numbers_should_return_STRAIGHT_as_value(self):
hand = Hand.from_string('2D 3D 4D 5D 6S')
self.assertEquals(hand.value, 'STRAIGHT')
示例10: test_hand_with_two_pairs_should_return_TWO_PAIRS_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_two_pairs_should_return_TWO_PAIRS_as_value(self):
hand = Hand.from_string('4D 4D 7H 7H KD')
self.assertEquals(hand.value, 'TWO_PAIR')
示例11: test_hand_with_same_four_cards_should_return_FOUR_OF_A_KIND_as_value
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_hand_with_same_four_cards_should_return_FOUR_OF_A_KIND_as_value(self):
hand = Hand.from_string('4D 4D 4C 4C KS')
self.assertEquals(hand.value, 'FOUR_OF_A_KIND')
示例12: test_when_higher_two_pairs_tie_higher_card_should_win
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_when_higher_two_pairs_tie_higher_card_should_win(self):
winner_hand = Hand.from_string('4D 4D 7H 7H AD')
looser_hand = Hand.from_string('4D 4D 7H 7H KD')
self.assertTrue(winner_hand > looser_hand)
示例13: test_when_higher_three_of_a_kind_tie_higher_card_should_win
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_when_higher_three_of_a_kind_tie_higher_card_should_win(self):
winner_hand = Hand.from_string('AD AD AS KH 2D')
looser_hand = Hand.from_string('AD AD AS 7H TD')
self.assertTrue(winner_hand > looser_hand)
示例14: test_when_two_pair_tie_higher_two_pair_should_win
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_when_two_pair_tie_higher_two_pair_should_win(self):
winner_hand = Hand.from_string('4D 4D AH AH KD')
looser_hand = Hand.from_string('4D 4D 2H 2H 8D')
self.assertTrue(winner_hand > looser_hand)
示例15: test_when_higher_one_pair_tie_higher_card_should_win
# 需要导入模块: from hand import Hand [as 别名]
# 或者: from hand.Hand import from_string [as 别名]
def test_when_higher_one_pair_tie_higher_card_should_win(self):
winner_hand = Hand.from_string('9D 9D 2D 7H 5D')
looser_hand = Hand.from_string('9D 9D 2D 7H 3D')
self.assertTrue(winner_hand > looser_hand)