Skip to content

Commit 61376c5

Browse files
committed
TST: Add test for gh_39
This tests whether IRR returns the expected positive rate rather than a smaller but negative rate.
1 parent e624d26 commit 61376c5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

numpy_financial/tests/test_financial.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,3 +624,16 @@ def test_gh_15(self):
624624
# Very rough approximation taken from the issue.
625625
desired = -0.9999999990596069
626626
assert_allclose(result, desired, rtol=1e-9)
627+
628+
def test_gh_39(self):
629+
cashflows = numpy.array([
630+
-217500.0, -217500.0, 108466.80462450592, 101129.96439328062,
631+
93793.12416205535, 86456.28393083003, 79119.44369960476,
632+
71782.60346837944, 64445.76323715414, 57108.92300592884,
633+
49772.08277470355, 42435.24254347826, 35098.40231225296,
634+
27761.56208102766, 20424.721849802358, 13087.88161857707,
635+
5751.041387351768, -1585.7988438735192, -8922.639075098821,
636+
-16259.479306324123, -23596.31953754941, -30933.159768774713,
637+
-38270.0, -45606.8402312253, -52943.680462450604,
638+
-60280.520693675906, -67617.36092490121])
639+
assert_almost_equal(npf.irr(cashflows), 0.12)

0 commit comments

Comments
 (0)