当前位置: 首页>>代码示例>>Python>>正文


Python Hand.from_string方法代码示例

本文整理汇总了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')
开发者ID:hugoantunes,项目名称:poker,代码行数:10,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:12,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:6,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:6,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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')
开发者ID:hugoantunes,项目名称:poker,代码行数:5,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:6,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:6,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:6,代码来源:test.py

示例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)
开发者ID:hugoantunes,项目名称:poker,代码行数:6,代码来源:test.py


注:本文中的hand.Hand.from_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。