Skip to content

Commit dfcb006

Browse files
authored
Synced exercise tests to problem specificatoins. (#3580)
1 parent ca3f65e commit dfcb006

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

exercises/practice/poker/.meta/tests.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ description = "a tie has multiple winners"
2121
[61ed83a9-cfaa-40a5-942a-51f52f0a8725]
2222
description = "multiple hands with the same high cards, tie compares next highest ranked, down to last card"
2323

24+
[da01becd-f5b0-4342-b7f3-1318191d0580]
25+
description = "winning high card hand also has the lowest card"
26+
2427
[f7175a89-34ff-44de-b3d7-f6fd97d1fca4]
2528
description = "one pair beats high card"
2629

2730
[e114fd41-a301-4111-a9e7-5a7f72a76561]
2831
description = "highest pair wins"
2932

33+
[b3acd3a7-f9fa-4647-85ab-e0a9e07d1365]
34+
description = "both hands have the same pair, high card wins"
35+
3036
[935bb4dc-a622-4400-97fa-86e7d06b1f76]
3137
description = "two pairs beats one pair"
3238

@@ -53,6 +59,11 @@ description = "both hands have three of a kind, tie goes to highest ranked tripl
5359

5460
[eb856cc2-481c-4b0d-9835-4d75d07a5d9d]
5561
description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards"
62+
include = false
63+
64+
[26a4a7d4-34a2-4f18-90b4-4a8dd35d2bb1]
65+
description = "with multiple decks, two players can have same three of a kind, ties go to highest remaining cards"
66+
reimplements = "eb856cc2-481c-4b0d-9835-4d75d07a5d9d"
5667

5768
[a858c5d9-2f28-48e7-9980-b7fa04060a60]
5869
description = "a straight beats three of a kind"
@@ -77,6 +88,11 @@ description = "flush beats a straight"
7788

7889
[4d90261d-251c-49bd-a468-896bf10133de]
7990
description = "both hands have a flush, tie goes to high card, down to the last one if necessary"
91+
include = false
92+
93+
[e04137c5-c19a-4dfc-97a1-9dfe9baaa2ff]
94+
description = "both hands have a flush, tie goes to high card, down to the last one if necessary"
95+
reimplements = "4d90261d-251c-49bd-a468-896bf10133de"
8096

8197
[3a19361d-8974-455c-82e5-f7152f5dba7c]
8298
description = "full house beats a flush"

exercises/practice/poker/poker_test.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These tests are auto-generated with test data from:
22
# https://github.com/exercism/problem-specifications/tree/main/exercises/poker/canonical-data.json
3-
# File last updated on 2023-07-19
3+
# File last updated on 2023-12-27
44

55
import unittest
66

@@ -39,6 +39,11 @@ def test_multiple_hands_with_the_same_high_cards_tie_compares_next_highest_ranke
3939
best_hands(["3S 5H 6S 8D 7H", "2S 5D 6D 8C 7S"]), ["3S 5H 6S 8D 7H"]
4040
)
4141

42+
def test_winning_high_card_hand_also_has_the_lowest_card(self):
43+
self.assertEqual(
44+
best_hands(["2S 5H 6S 8D 7H", "3S 4D 6D 8C 7S"]), ["2S 5H 6S 8D 7H"]
45+
)
46+
4247
def test_one_pair_beats_high_card(self):
4348
self.assertEqual(
4449
best_hands(["4S 5H 6C 8D KH", "2S 4H 6S 4D JH"]), ["2S 4H 6S 4D JH"]
@@ -49,6 +54,11 @@ def test_highest_pair_wins(self):
4954
best_hands(["4S 2H 6S 2D JH", "2S 4H 6C 4D JD"]), ["2S 4H 6C 4D JD"]
5055
)
5156

57+
def test_both_hands_have_the_same_pair_high_card_wins(self):
58+
self.assertEqual(
59+
best_hands(["4H 4S AH JC 3D", "4C 4D AS 5D 6C"]), ["4H 4S AH JC 3D"]
60+
)
61+
5262
def test_two_pairs_beats_one_pair(self):
5363
self.assertEqual(
5464
best_hands(["2S 8H 6S 8D JH", "4S 5H 4C 8C 5C"]), ["4S 5H 4C 8C 5C"]
@@ -99,7 +109,7 @@ def test_with_multiple_decks_two_players_can_have_same_three_of_a_kind_ties_go_t
99109
self,
100110
):
101111
self.assertEqual(
102-
best_hands(["4S AH AS 7C AD", "4S AH AS 8C AD"]), ["4S AH AS 8C AD"]
112+
best_hands(["5S AH AS 7C AD", "4S AH AS 8C AD"]), ["4S AH AS 8C AD"]
103113
)
104114

105115
def test_a_straight_beats_three_of_a_kind(self):
@@ -143,7 +153,7 @@ def test_both_hands_have_a_flush_tie_goes_to_high_card_down_to_the_last_one_if_n
143153
self,
144154
):
145155
self.assertEqual(
146-
best_hands(["4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S"]), ["4H 7H 8H 9H 6H"]
156+
best_hands(["2H 7H 8H 9H 6H", "3S 5S 6S 7S 8S"]), ["2H 7H 8H 9H 6H"]
147157
)
148158

149159
def test_full_house_beats_a_flush(self):

0 commit comments

Comments
 (0)