-
Notifications
You must be signed in to change notification settings - Fork 0
/
play_test.py
35 lines (26 loc) · 885 Bytes
/
play_test.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
26
27
28
29
30
31
32
33
34
35
import unittest
from play import Play
from card import Card, CardSuit, CardValue
class GameTest(unittest.TestCase):
def setUp(self):
self.play = Play()
def test_init(self):
self.assertEqual(self.play.cards, [])
def test_append(self):
# Setup
card = Card(CardValue.TEN, CardSuit.HEARTS)
# Run
self.play.append(card)
# Assert
self.assertEqual(card, self.play.cards[0])
def test_calculateExtraPoints_runOfThree(self):
# Setup
self.play.append(Card(CardValue.TEN, CardSuit.HEARTS))
self.play.append(Card(CardValue.NINE, CardSuit.HEARTS))
self.play.append(Card(CardValue.EIGHT, CardSuit.HEARTS))
# Run
extraPoints = self.play.calculateExtraPoints()
# Assert
self.assertEqual(extraPoints, 3)
if __name__ == '__main__':
unittest.main()