-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFunnyList4.py
More file actions
executable file
·36 lines (28 loc) · 1 KB
/
TestFunnyList4.py
File metadata and controls
executable file
·36 lines (28 loc) · 1 KB
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
from funnylist import FunnyList
import unittest
class TestFunnyList(unittest.TestCase):
def setUp(self):
# create two standard Python lists
self.list1 = [1, 2, 3]
self.list2 = [3, 2, 1]
# create a combined list of the above
self.clist = self.list1 + self.list2
# create two FunnyLists from the lists
self.fl1 = FunnyList(self.list1)
self.fl2 = FunnyList(self.list2)
def test_equal(self):
"""Check for equality."""
self.assertTrue(self.fl1 == self.fl2)
def test_add_two(self):
"""Check that adding two FunnyLists together
yields the same result as adding two lists
together.
"""
self.fl3 = self.fl1 + self.fl2
self.assertEqual(self.fl3, self.clist)
def test_add_int(self):
"""Check that we can add an integer to a FunnyList."""
self.fl3 = self.fl1 + 10
self.list1.append(10)
self.assertEqual(self.fl3, self.list1)
unittest.main()