summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2012-12-16 12:51:05 -0700
committerCharles Harris <charlesr.harris@gmail.com>2012-12-16 12:51:05 -0700
commit36ea64728586003b6a70ea9ff2c2e021481b8fc5 (patch)
tree5d525fa2b069050de3e392a94aeb9523e9d9d7ee /numpy
parentf7555b9b8237f88b83722d2a1533cc8585ef0737 (diff)
downloadnumpy-36ea64728586003b6a70ea9ff2c2e021481b8fc5.tar.gz
TST: Add tests for constants.
Test the values of np.pi, np.e, and np.euler_gamma to make sure they are correct to relative tolerance 1e-15.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_umath.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 892b1fae6..bd281e000 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -20,6 +20,19 @@ class _FilterInvalids(object):
np.seterr(**self.olderr)
+class TestConstants(TestCase):
+ def test_pi(self):
+ assert_allclose(ncu.pi, 3.141592653589793, 1e-15)
+
+
+ def test_e(self):
+ assert_allclose(ncu.e, 2.718281828459045, 1e-15)
+
+
+ def test_euler_gamma(self):
+ assert_allclose(ncu.euler_gamma, 0.5772156649015329, 1e-15)
+
+
class TestDivision(TestCase):
def test_division_int(self):
# int division should follow Python