本文整理匯總了Python中Deck.sort方法的典型用法代碼示例。如果您正苦於以下問題:Python Deck.sort方法的具體用法?Python Deck.sort怎麽用?Python Deck.sort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Deck
的用法示例。
在下文中一共展示了Deck.sort方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_05_shuffle
# 需要導入模塊: import Deck [as 別名]
# 或者: from Deck import sort [as 別名]
def test_05_shuffle(self):
d1 = Deck()
d2 = Deck()
d1.shuffle()
self.assertFalse(same_cards(d1,d2), "deck wasn't shuffled")
d1.sort()
self.assertTrue(same_cards(d1,d2), "deck wasn't sorted")
示例2: test_06_hands
# 需要導入模塊: import Deck [as 別名]
# 或者: from Deck import sort [as 別名]
def test_06_hands(self):
d = Deck()
h = d.deal(5)
self.assertEqual(5, len(h), "hand doesn't have 5 cards")
self.assertEqual(47, len(d), "hand wasn't removed from deck")
d.restore(h)
self.assertEqual(52, len(d), "had wasn't put back in deck")
d.sort()
self.assertTrue(same_cards(d, Deck()), "restored deck incomplete")