-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest.py
More file actions
38 lines (33 loc) · 707 Bytes
/
test.py
File metadata and controls
38 lines (33 loc) · 707 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
31
32
33
34
35
36
37
38
import unittest
from matrix import Matrix
# write your test cases here
class TestMatrix(unittest.TestCase):
def test_print(self):
m1 = Matrix([
[1,2,3],
[4,5,6],
])
expected_str_matrix = "[1, 2, 3]\n[4, 5, 6]\n"
self.assertEqual(str(m1),expected_str_matrix)
def test_shape(self):
m1 = Matrix([
[1,2,3],
[4,5,6],
])
m2 = Matrix(
[
[
[1,2,3],
[4,5,6],
],
[
[1,2,3],
[4,5,6],
]
]
)
# add more test cases if you feel like!
self.assertEqual(m1.shape(),(2,3))
self.assertEqual(m2.shape(),(2,2,3))
if __name__ == '__main__':
unittest.main()