MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / test_euler_project

Function test_euler_project

project_euler/problem_054/test_poker_hand.py:214–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212
213
214def test_euler_project():
215 # Problem number 54 from Project Euler
216 # Testing from poker_hands.txt file
217 answer = 0
218 script_dir = os.path.abspath(os.path.dirname(__file__))
219 poker_hands = os.path.join(script_dir, "poker_hands.txt")
220 with open(poker_hands) as file_hand:
221 for line in file_hand:
222 player_hand = line[:14].strip()
223 opponent_hand = line[15:].strip()
224 player, opponent = PokerHand(player_hand), PokerHand(opponent_hand)
225 output = player.compare_with(opponent)
226 if output == "Win":
227 answer += 1
228 assert answer == 376

Callers

nothing calls this directly

Calls 2

PokerHandClass · 0.85
compare_withMethod · 0.80

Tested by

no test coverage detected