- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_pairwise_python.py
More file actions
Latest commit
25 lines (19 loc) · 638 Bytes
/
Copy pathtest_pairwise_python.py
File metadata and controls
25 lines (19 loc) · 638 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
""" Unit-testing module for python implementation of pairwise sum calculation
"""
importnumpyasnp
frompairwise_sum_pythonimportpairwise_sum_python
__all__= ('test_python_serial1', )
deftest_python_serial1():
""" Hard-coded test that serial python function is correct.
"""
x=np.arange(1, 5)
y=np.zeros(7)
z=pairwise_sum_python(x, y)
assertnp.all(z==np.repeat(x, len(y)))
deftest_python_serial2():
""" Hard-coded test that serial python function is correct.
"""
x= (1, 2, 3)
y= (4, 5, 6)
z=pairwise_sum_python(x, y)
assertnp.all(z== (5, 6, 7, 6, 7, 8, 7, 8, 9))