summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_financial.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2008-04-04 06:11:24 +0000
committerTravis Oliphant <oliphant@enthought.com>2008-04-04 06:11:24 +0000
commiteffc09b20ea3146d3dcfc6884b4321ddf1638cb5 (patch)
treeb730047a85df6b1c374c473979e6614c27692b50 /numpy/lib/tests/test_financial.py
parentd396f126cc9ac2f215c1363a8f8650d6c4e6c161 (diff)
downloadnumpy-effc09b20ea3146d3dcfc6884b4321ddf1638cb5.tar.gz
Add fromregex function (needs more testing) and some simple spreadsheet-like financial calculations.
Diffstat (limited to 'numpy/lib/tests/test_financial.py')
-rw-r--r--numpy/lib/tests/test_financial.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_financial.py b/numpy/lib/tests/test_financial.py
new file mode 100644
index 000000000..bf0b4dfd4
--- /dev/null
+++ b/numpy/lib/tests/test_financial.py
@@ -0,0 +1,34 @@
+"""
+from numpy.lib.financial import *
+
+>>> rate(10,0,-3500,10000)
+0.11069085371426901
+
+>>> irr([-150000, 15000, 25000, 35000, 45000, 60000])
+0.052432888859414106
+
+>>> pv(0.07,20,12000,0)
+-127128.17094619398
+
+>>> fv(0.075, 20, -2000,0,0)
+86609.362673042924
+
+>>> pmt(0.08/12,5*12,15000)
+-304.14591432620773
+
+>>> nper(0.075,-2000,0,100000.)
+21.544944197323336
+
+>>> npv(0.05,[-15000,1500,2500,3500,4500,6000])
+117.04271900089589
+
+"""
+
+from numpy.testing import *
+import numpy as np
+
+class TestDocs(NumpyTestCase):
+ def check_doctests(self): return self.rundocs()
+
+if __name__ == "__main__":
+ NumpyTest().run()