-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_player.py
25 lines (21 loc) · 1.05 KB
/
test_player.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import unittest
from player import Player
from test_helpers import stub_finished_targets, stub_unfinished_targets
from helpers import new_target, TARGET_VALUES
class TestPlayer(unittest.TestCase):
def test_add_shot_to_target(self):
player = Player('1', 0, stub_unfinished_targets())
player.targets[0]['shots'] = 0
player.targets[0]['value'] = TARGET_VALUES[0]
player.targets[0]['status'] = 'unopened'
player.add_shots_to_target(TARGET_VALUES[0], 1)
self.assertEqual(player.targets[0]['shots'], 1)
self.assertEqual(player.targets[0]['status'], 'unopened')
def test_player_completed_all_targets_true_when_all_targets_closed(self):
player = Player('1', 0, stub_finished_targets())
self.assertTrue(player.completed_all_targets)
def test_player_has_winning_score_true_when_greater_than_or_equal_to_best_in_all_scores(self):
player = Player('1', 100, stub_finished_targets())
self.assertTrue(player.has_winning_score([99, 1, 23, 100]))
if __name__ == '__main__':
unittest.main()