本文整理汇总了Python中Deck.drawGuarantee方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.drawGuarantee方法的具体用法?Python Deck.drawGuarantee怎么用?Python Deck.drawGuarantee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck
的用法示例。
在下文中一共展示了Deck.drawGuarantee方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deck
# 需要导入模块: import Deck [as 别名]
# 或者: from Deck import drawGuarantee [as 别名]
def test_deck(self):
a = Card(ONE, RED, FILLED, STAR)
b = Card(TWO, RED, FILLED, STAR)
c = Card(THREE, RED, FILLED, STAR)
d = Card(THREE, RED, FILLED, CIRCLE)
e = Card(THREE, RED, FILLED, SQUARE)
self.assertEqual(Deck.numberOfSets([a, b, c, d, e]), 2)
self.assertTrue(Deck.hasSet([a, b, c, d, e]))
badSet = {Card(number=3, colour=5, filling=8, shape=11),
Card(number=2, colour=6, filling=7, shape=12),
Card(number=2, colour=6, filling=9, shape=11)}
self.assertFalse(Deck.hasSet(badSet))
self.assertEqual(Deck.similarities(*list(badSet)), 0)
self.assertTrue(
Deck.hasSet({Card(number=3, colour=5, filling=8, shape=11),
Card(number=2, colour=6, filling=7, shape=12),
Card(number=2, colour=6, filling=9, shape=11)} | {a}))
deck = Deck()
threeCards = deck.drawGuarantee()
self.assertTrue(Deck.hasSet(threeCards))
self.assertRaises(
ValueError, lambda x: deck.drawGuarantee(numberofcards=x), 0)