summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2017-10-21 21:45:24 +0200
committerStefan Behnel <stefan_ml@behnel.de>2017-10-22 12:41:18 +0200
commit27ec276b12ef0e3bc2b82c9f29d0c496cc4ffccf (patch)
tree37575b5e21a7b2c290eaff68aa278234b8242d85
parentb67bfd5c422801cd5062bbc39b251d20bfd45bda (diff)
downloadcython-27ec276b12ef0e3bc2b82c9f29d0c496cc4ffccf.tar.gz
Fix test output of Pythran test and give a better name to a test function.
-rw-r--r--tests/run/numpy_pythran.pyx9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/run/numpy_pythran.pyx b/tests/run/numpy_pythran.pyx
index 8d7565b60..e854c5fae 100644
--- a/tests/run/numpy_pythran.pyx
+++ b/tests/run/numpy_pythran.pyx
@@ -5,9 +5,9 @@
import numpy as np
cimport numpy as cnp
-def test():
+def diffuse():
"""
- >>> u = test()
+ >>> u = diffuse()
>>> count_non_zero = np.sum(u > 0)
>>> 15000 < count_non_zero < (2**7) * (2**7) or count_non_zero
True
@@ -15,11 +15,11 @@ def test():
lx, ly = (2**7, 2**7)
u = np.zeros([lx, ly], dtype=np.double)
u[lx // 2, ly // 2] = 1000.0
- diffuse_numpy(u, 500)
+ _diffuse_numpy(u, 500)
return u
-def diffuse_numpy(cnp.ndarray[double, ndim=2] u, int N):
+def _diffuse_numpy(cnp.ndarray[double, ndim=2] u, int N):
"""
Apply Numpy matrix for the Forward-Euler Approximation
"""
@@ -41,6 +41,7 @@ def calculate_tax(cnp.ndarray[double, ndim=1] d):
>>> d = np.random.lognormal(mu, sigma, 10000)
>>> avg = calculate_tax(d)
>>> 0.243 < avg < 0.244 or avg # 0.24342652180085891
+ True
"""
tax_seg1 = d[(d > 256303)] * 0.45 - 16164.53
tax_seg2 = d[(d > 54057) & (d <= 256303)] * 0.42 - 8475.44