Skip to content

Commit d95c032

Browse files
committed
[DOC] Fix doctest failure issue. Resolves issue #94
1 parent 8fa019f commit d95c032

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

numpy_financial/_financial.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def fv(rate, nper, pmt, pv, when='end'):
146146
5% (annually) compounded monthly?
147147
148148
>>> npf.fv(0.05/12, 10*12, -100, -100)
149-
15692.928894335748
149+
15692.92889433575
150150
151151
By convention, the negative sign represents cash flow out (i.e. money not
152152
available today). Thus, saving $100 a month at 5% annual interest leads
@@ -157,7 +157,7 @@ def fv(rate, nper, pmt, pv, when='end'):
157157
158158
>>> a = np.array((0.05, 0.06, 0.07))/12
159159
>>> npf.fv(a, 10*12, -100, -100)
160-
array([ 15692.92889434, 16569.87435405, 17509.44688102]) # may vary
160+
array([15692.92889434, 16569.87435405, 17509.44688102])
161161
162162
"""
163163
when = _convert_when(when)
@@ -327,9 +327,9 @@ def nper(rate, pmt, pv, fv=0, when='end'):
327327
... 8000 : 9001 : 1000]))
328328
array([[[ 64.07334877, 74.06368256],
329329
[108.07548412, 127.99022654]],
330+
<BLANKLINE>
330331
[[ 66.12443902, 76.87897353],
331332
[114.70165583, 137.90124779]]])
332-
333333
"""
334334
when = _convert_when(when)
335335
rate, pmt, pv, fv, when = np.broadcast_arrays(rate, pmt, pv, fv, when)
@@ -592,7 +592,7 @@ def pv(rate, nper, pmt, fv=0, when='end'):
592592
593593
>>> a = np.array((0.05, 0.04, 0.03))/12
594594
>>> npf.pv(a, 10*12, -100, 15692.93)
595-
array([ -100.00067132, -649.26771385, -1273.78633713]) # may vary
595+
array([ -100.00067132, -649.26771385, -1273.78633713])
596596
597597
So, to end up with the same $15692.93 under the same $100 per month
598598
"savings plan," for annual interest rates of 4% and 3%, one would
@@ -931,7 +931,7 @@ def npv(rate, values):
931931
net present value:
932932
933933
>>> rate, cashflows = 0.08, [-40_000, 5_000, 8_000, 12_000, 30_000]
934-
>>> npf.npv(rate, cashflows).round(5)
934+
>>> round(npf.npv(rate, cashflows), 5)
935935
3065.22267
936936
937937
It may be preferable to split the projected cashflow into an initial
@@ -1062,9 +1062,9 @@ def mirr(values, finance_rate, reinvest_rate, *, raise_exceptions=False):
10621062
and the `raise_exceptions` parameter is set to True.
10631063
10641064
>>> npf.mirr([100, 50, 60, 70], 0.10, 0.12, raise_exceptions=True)
1065-
NoRealSolutionError: No real solution exists for MIRR since all
1066-
cashflows are of the same sign.
1067-
1065+
Traceback (most recent call last):
1066+
...
1067+
numpy_financial._financial.NoRealSolutionError: No real solution exists for MIRR since all cashflows are of the same sign.
10681068
"""
10691069
values = np.asarray(values)
10701070
n = values.size

0 commit comments

Comments
 (0)