-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2-matrix_divided.txt
52 lines (38 loc) · 1.49 KB
/
2-matrix_divided.txt
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
2-matrix_divided module tests
==========================
`matrix_divided` function tests
--------------------------
>>> matrix_divided = __import__('2-matrix_divided').matrix_divided
>>> matrix_divided(None, None)
Traceback (most recent call last):
TypeError: matrix must be a matrix (list of lists) of integers/floats
>>> matrix_divided([2, 3], 2)
Traceback (most recent call last):
TypeError: matrix must be a matrix (list of lists) of integers/floats
>>> matrix_divided([[1, 2], [3, 4, 5]], 2)
Traceback (most recent call last):
TypeError: Each row of the matrix must have the same size
>>> matrix_divided([[1, 2], [3, 4, '3']], 2)
Traceback (most recent call last):
TypeError: Each row of the matrix must have the same size
>>> matrix_divided([[1, 2], [3, '3']], 2)
Traceback (most recent call last):
TypeError: matrix must be a matrix (list of lists) of integers/floats
>>> matrix_divided([[1, 2], [3, 9]], None)
Traceback (most recent call last):
TypeError: div must be a number
>>> matrix_divided([[1, 2], [3, 9]], 0)
Traceback (most recent call last):
ZeroDivisionError: division by zero
>>> matrix_divided([[1, 2], [3, 9]], 1e1000)
[[0.0, 0.0], [0.0, 0.0]]
>>> matrix_divided([[1, 2], [3, 9]], 2)
[[0.5, 1.0], [1.5, 4.5]]
>>> matrix_divided([[1, 2], [3, 9]], 2.5)
[[0.4, 0.8], [1.2, 3.6]]
>>> matrix_divided([[1, 2], [3, 9]], 3)
[[0.33, 0.67], [1.0, 3.0]]
>>> matrix_divided([[1, 2], [3, 1e1000]], 3)
[[0.33, 0.67], [1.0, inf]]
>>> matrix_divided([[1, 2], [3, -1e1000]], 3)
[[0.33, 0.67], [1.0, -inf]]