Skip to content

Commit 38e6819

Browse files
committed
[DOC] Fix doctest failure issue. Resolves issue #94
1 parent 2153b60 commit 38e6819

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
@@ -115,7 +115,7 @@ def fv(rate, nper, pmt, pv, when='end'):
115115
5% (annually) compounded monthly?
116116
117117
>>> npf.fv(0.05/12, 10*12, -100, -100)
118-
15692.928894335748
118+
15692.92889433575
119119
120120
By convention, the negative sign represents cash flow out (i.e. money not
121121
available today). Thus, saving $100 a month at 5% annual interest leads
@@ -126,7 +126,7 @@ def fv(rate, nper, pmt, pv, when='end'):
126126
127127
>>> a = np.array((0.05, 0.06, 0.07))/12
128128
>>> npf.fv(a, 10*12, -100, -100)
129-
array([ 15692.92889434, 16569.87435405, 17509.44688102]) # may vary
129+
array([15692.92889434, 16569.87435405, 17509.44688102])
130130
131131
"""
132132
when = _convert_when(when)
@@ -296,9 +296,9 @@ def nper(rate, pmt, pv, fv=0, when='end'):
296296
... 8000 : 9001 : 1000]))
297297
array([[[ 64.07334877, 74.06368256],
298298
[108.07548412, 127.99022654]],
299+
<BLANKLINE>
299300
[[ 66.12443902, 76.87897353],
300301
[114.70165583, 137.90124779]]])
301-
302302
"""
303303
when = _convert_when(when)
304304
rate, pmt, pv, fv, when = np.broadcast_arrays(rate, pmt, pv, fv, when)
@@ -561,7 +561,7 @@ def pv(rate, nper, pmt, fv=0, when='end'):
561561
562562
>>> a = np.array((0.05, 0.04, 0.03))/12
563563
>>> npf.pv(a, 10*12, -100, 15692.93)
564-
array([ -100.00067132, -649.26771385, -1273.78633713]) # may vary
564+
array([ -100.00067132, -649.26771385, -1273.78633713])
565565
566566
So, to end up with the same $15692.93 under the same $100 per month
567567
"savings plan," for annual interest rates of 4% and 3%, one would
@@ -878,7 +878,7 @@ def npv(rate, values):
878878
net present value:
879879
880880
>>> rate, cashflows = 0.08, [-40_000, 5_000, 8_000, 12_000, 30_000]
881-
>>> npf.npv(rate, cashflows).round(5)
881+
>>> round(npf.npv(rate, cashflows), 5)
882882
3065.22267
883883
884884
It may be preferable to split the projected cashflow into an initial
@@ -967,9 +967,9 @@ def mirr(values, finance_rate, reinvest_rate, *, raise_exceptions=False):
967967
and the `raise_exceptions` parameter is set to True.
968968
969969
>>> npf.mirr([100, 50, 60, 70], 0.10, 0.12, raise_exceptions=True)
970-
NoRealSolutionError: No real solution exists for MIRR since all
971-
cashflows are of the same sign.
972-
970+
Traceback (most recent call last):
971+
...
972+
numpy_financial._financial.NoRealSolutionError: No real solution exists for MIRR since all cashflows are of the same sign.
973973
"""
974974
values = np.asarray(values)
975975
n = values.size

0 commit comments

Comments
 (0)