-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_pairwise_cython.py
More file actions
35 lines (26 loc) · 928 Bytes
/
test_pairwise_cython.py
File metadata and controls
35 lines (26 loc) · 928 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
"""
"""
import numpy as np
from pairwise_sum_cython import pairwise_sum_cython
from pairwise_sum_python import pairwise_sum_python
__all__ = ('test_pairwise_sum_cython1', )
def test_pairwise_sum_cython1():
x = np.arange(-50, 50).astype('f8')
y = np.arange(-500, 500, 10).astype('f8')
python_result = pairwise_sum_python(x, y)
cython_result = pairwise_sum_cython(x, y)
assert np.all(cython_result == python_result)
def test_pairwise_sum_cython2():
np.random.seed(43)
x = np.random.random(100)
y = np.random.random(200)
python_result = pairwise_sum_python(x, y)
cython_result = pairwise_sum_cython(x, y)
assert np.all(cython_result == python_result)
def test_simple_cython():
np.random.seed(43)
x = np.random.random(100)
y = np.random.random(200)
result1 = pairwise_sum_cython(x, y)
result2 = pairwise_sum_cython(x, y)
assert np.all(result1 == result2)