summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2008-04-08 20:43:07 +0000
committerTravis Oliphant <oliphant@enthought.com>2008-04-08 20:43:07 +0000
commitb21be67447392e59eace316f8708c4e17fa70a35 (patch)
treef0b0b3acd91ad784354e1dd53de9614fc6975580 /numpy/lib/tests
parente4e3018081ad2ab92850ca246ec25dda754c0184 (diff)
downloadnumpy-b21be67447392e59eace316f8708c4e17fa70a35.tar.gz
Fix doc-tests for financial.py so they don't rely on floating-point exactness. Start filling in final function.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_financial.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/numpy/lib/tests/test_financial.py b/numpy/lib/tests/test_financial.py
index c3153ffb9..ee38c10dc 100644
--- a/numpy/lib/tests/test_financial.py
+++ b/numpy/lib/tests/test_financial.py
@@ -1,32 +1,32 @@
"""
-from numpy import *
+>>> from numpy import rate, irr, pv, fv, pmt, nper, npv, mirr, round
->>> rate(10,0,-3500,10000)
-0.11069085371426901
+>>> round(rate(10,0,-3500,10000),4)==0.1107
+True
->>> irr([-150000, 15000, 25000, 35000, 45000, 60000])
-0.052432888859414106
+>>> round(irr([-150000, 15000, 25000, 35000, 45000, 60000]),4)==0.0524
+True
->>> pv(0.07,20,12000,0)
--127128.17094619398
+>>> round(pv(0.07,20,12000,0),2) == -127128.17
+True
->>> fv(0.075, 20, -2000,0,0)
-86609.362673042924
+>>> round(fv(0.075, 20, -2000,0,0),2) == 86609.36
+True
->>> pmt(0.08/12,5*12,15000)
--304.14591432620773
+>>> round(pmt(0.08/12,5*12,15000),3) == -304.146
+True
->>> nper(0.075,-2000,0,100000.)
-21.544944197323336
+>>> round(nper(0.075,-2000,0,100000.),2) == 21.54
+True
->>> npv(0.05,[-15000,1500,2500,3500,4500,6000])
-117.04271900089589
+>>> round(npv(0.05,[-15000,1500,2500,3500,4500,6000]),2) == 117.04
+True
->>> mirr([-4500,-800,800,800,600,600,800,800,700,3000],0.08,0.055)
-0.066471183500200537
+>>> round(mirr([-4500,-800,800,800,600,600,800,800,700,3000],0.08,0.055),4) == 0.0665
+True
->>> mirr([-120000,39000,30000,21000,37000,46000],0.10,0.12)
-0.13439316981387006
+>>> round(mirr([-120000,39000,30000,21000,37000,46000],0.10,0.12),4)==0.1344
+True
"""
from numpy.testing import *