summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2016-02-29 10:52:17 -0700
committerCharles Harris <charlesr.harris@gmail.com>2016-02-29 10:52:17 -0700
commit682a6910ad8be25afc2e449f12b87c1c291dd1d1 (patch)
treea6a7bf8de4ad3291be6048a9377226cdbe7bb273 /numpy/lib/tests
parent1bd18cd7ea1ed83243777c1f52f369dfb9048e6c (diff)
parent3fdf3270e6f47e65d8a8b4d995fc21f9b64650ee (diff)
downloadnumpy-682a6910ad8be25afc2e449f12b87c1c291dd1d1.tar.gz
Merge pull request #7332 from simongibbons/irr_empty_check
Check for no solution in np.irr Fixes #6744
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_financial.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_financial.py b/numpy/lib/tests/test_financial.py
index baa785424..cc8ba55e5 100644
--- a/numpy/lib/tests/test_financial.py
+++ b/numpy/lib/tests/test_financial.py
@@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_almost_equal,
- assert_allclose
+ assert_allclose, assert_equal
)
@@ -26,6 +26,11 @@ class TestFinancial(TestCase):
v = [-5, 10.5, 1, -8, 1]
assert_almost_equal(np.irr(v), 0.0886, 2)
+ # Test that if there is no solution then np.irr returns nan
+ # Fixes gh-6744
+ v = [-1, -2, -3]
+ assert_equal(np.irr(v), np.nan)
+
def test_pv(self):
assert_almost_equal(np.pv(0.07, 20, 12000, 0), -127128.17, 2)