Beispiel #1
0
 def test_get_score_straight_flush(self):
     hand1 = 'TC JC QC KC AC'
     hand2 = 'TD JS QD KS AC'
     hand3 = 'TC JC QC KC 9C'
     cards1 = create_readable_cards(hand1.split(' '))
     cards2 = create_readable_cards(hand2.split(' '))
     cards3 = create_readable_cards(hand3.split(' '))
     self.assertNotEqual(get_score(cards1), 9)
     self.assertNotEqual(get_score(cards2), 9)
     self.assertEqual(get_score(cards3), 9)
Beispiel #2
0
 def test_get_score_straight(self):
     hand1 = '2C 2C 2C 2C 6C'
     hand2 = '2D 3S 2D 2S 2C'
     hand3 = '3C 7C 4S 5C 6C'
     hand4 = 'TS JS QC KC AC'
     cards1 = create_readable_cards(hand1.split(' '))
     cards2 = create_readable_cards(hand2.split(' '))
     cards3 = create_readable_cards(hand3.split(' '))
     cards4 = create_readable_cards(hand4.split(' '))
     self.assertNotEqual(get_score(cards1), 5)
     self.assertNotEqual(get_score(cards2), 5)
     self.assertEqual(get_score(cards3), 5)
     self.assertEqual(get_score(cards4), 5)
Beispiel #3
0
 def test_get_score_flush(self):
     hand1 = '2C 2C 2C 2C 6C'
     hand2 = '2D 3S 2D 2S 2C'
     hand3 = '2C 8C 4C 5C 6C'
     hand4 = '3S 2C 3C 3C 3C'
     cards1 = create_readable_cards(hand1.split(' '))
     cards2 = create_readable_cards(hand2.split(' '))
     cards3 = create_readable_cards(hand3.split(' '))
     cards4 = create_readable_cards(hand4.split(' '))
     self.assertNotEqual(get_score(cards1), 6)
     self.assertNotEqual(get_score(cards2), 6)
     self.assertEqual(get_score(cards3), 6)
     self.assertNotEqual(get_score(cards4), 6)
Beispiel #4
0
 def test_get_score_one_pair(self):
     hand1 = '2C 2C 3S 4C 6C'
     hand2 = '2D 3S 2D 2S 2C'
     hand3 = '2C 8S 4C 8C 6C'
     hand4 = '3S 2C 3C 3C 2C'
     hand5 = '3S 2C 6C 7C 3C'
     cards1 = create_readable_cards(hand1.split(' '))
     cards2 = create_readable_cards(hand2.split(' '))
     cards3 = create_readable_cards(hand3.split(' '))
     cards4 = create_readable_cards(hand4.split(' '))
     cards5 = create_readable_cards(hand5.split(' '))
     self.assertEqual(get_score(cards1), 2)
     self.assertNotEqual(get_score(cards2), 2)
     self.assertEqual(get_score(cards3), 2)
     self.assertNotEqual(get_score(cards4), 2)
     self.assertEqual(get_score(cards5), 2)
Beispiel #5
0
 def test_get_score_two_pairs(self):
     hand1 = '2C 2C 3C 3C 6S'
     hand2 = '2D 3S 4D 2S 2C'
     hand3 = '2C 2C 4S 5C 5C'
     hand4 = '3S 2C 3C 3C 2C'
     hand5 = '3S 2C 6C 3C 3C'
     cards1 = create_readable_cards(hand1.split(' '))
     cards2 = create_readable_cards(hand2.split(' '))
     cards3 = create_readable_cards(hand3.split(' '))
     cards4 = create_readable_cards(hand4.split(' '))
     cards5 = create_readable_cards(hand5.split(' '))
     self.assertEqual(get_score(cards1), 3)
     self.assertNotEqual(get_score(cards2), 3)
     self.assertEqual(get_score(cards3), 3)
     self.assertNotEqual(get_score(cards4), 3)
     self.assertNotEqual(get_score(cards5), 3)
Beispiel #6
0
 def test_get_score_three_of_a_kind(self):
     hand1 = '2C 2C 2C 2C 6C'
     hand2 = '2D 3S 2D 2S 2C'
     hand3 = '2C 8C 4C 5C 6C'
     hand4 = '3S 2C 3C 3C 3C'
     hand5 = '3S 2C 6C 3C 3C'
     cards1 = create_readable_cards(hand1.split(' '))
     cards2 = create_readable_cards(hand2.split(' '))
     cards3 = create_readable_cards(hand3.split(' '))
     cards4 = create_readable_cards(hand4.split(' '))
     cards5 = create_readable_cards(hand5.split(' '))
     self.assertNotEqual(get_score(cards1), 4)
     self.assertNotEqual(get_score(cards2), 4)
     self.assertNotEqual(get_score(cards3), 4)
     self.assertNotEqual(get_score(cards4), 4)
     self.assertEqual(get_score(cards5), 4)