forked from NBHS-STEM/class_quiz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_card.py
More file actions
30 lines (23 loc) · 811 Bytes
/
test_card.py
File metadata and controls
30 lines (23 loc) · 811 Bytes
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
import unittest
from card import Card
class TestCard(unittest.TestCase):
def test_value(self):
sample = Card(3, "Cups")
self.assertEqual(sample.value, 3)
def test_suit(self):
sample = Card(3, "Cups")
self.assertEqual(sample.suit, "Cups")
def test_repr(self):
sample = Card(3, "Cups")
expected = "Card(value=3,suit=Cups)"
output = repr(sample).replace(' ','').replace('\'', '').replace('"', '')
self.assertEqual(output, expected)
def test_str(self):
sample = Card(3, "Cups")
self.assertEqual(str(sample), "3 of Cups")
def test_eq(self):
sample = Card(3, "Cups")
other_sample = Card(3, "Swords")
self.assertTrue(sample == other_sample)
if __name__ == '__main__':
unittest.main()