本文整理汇总了Python中analyzer.Analyzer._matching方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer._matching方法的具体用法?Python Analyzer._matching怎么用?Python Analyzer._matching使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer._matching方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestAnalyzer
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import _matching [as 别名]
#.........这里部分代码省略.........
expected = [self.p3]
self.assertEqual(expected, result)
def test_compare_multiple(self):
"""if there are multiple winners do we
return all of them?"""
players = self.analyzer._setup()
self.p0.hand = [0, 14, 12, 11, 10, 8]
self.p1.hand = [1, 14, 12, 11, 8]
self.p2.hand = [7, 10, 2]
self.p3.hand = [7, 10, 2]
self.p4.hand = [0]
self.p5.hand = [0]
result = self.analyzer._compare(players)
expected = [self.p2, self.p3]
self.assertEqual(expected, result)
def test_hi_card(self):
"""can we identify a hi card hand?"""
players = self.analyzer._setup()
self.p4.hole[0].value = 12
self.p4.hole[1].value = 11
self.p4.hole[2].value = 9
self.p4.hole[3].value = 14
self.p4.hole[4].value = 13
self.p4.hole[5].value = 3
self.p4.hole[6].value = 2
players = self.analyzer._order(players)
self.analyzer._matching(players)
expected = [0, 14, 13, 12, 11, 9]
self.assertEqual(self.p4.hand, expected)
def test_matching_hands(self):
"""can we find matching number hands
eg. pairs through quads??"""
players = self.analyzer._setup()
# quads
self.p0.hole[0].value = 14
self.p0.hole[1].value = 14
# boat
self.p1.hole[0].value = 14
self.p1.hole[1].value = 13
# trips
self.p2.hole[0].value = 14
self.p2.hole[1].value = 12
# two pair
self.p3.hole[0].value = 12
self.p3.hole[1].value = 12
# pair
self.p4.hole[0].value = 12
self.p4.hole[1].value = 11
self.p4.hole[2].value = 14
self.p4.hole[3].value = 14
self.p4.hole[4].value = 13