Esempio n. 1
0
    def test_NPV(self):
        self.assertAlmostEqual(financial.NPV(0.06, xl.RangeData([[1, 2, 3]])),
                               5.2422470)
        self.assertAlmostEqual(financial.NPV(0.06, 1, 2, 3), 5.2422470)
        self.assertAlmostEqual(financial.NPV(0.06, 1), 0.9433962)
        self.assertAlmostEqual(financial.NPV(0.1, -10000, 3000, 4200, 6800),
                               1188.44, 2)

        range1 = xl.RangeData([[8000, 9200, 10000, 12000, 14500]])
        self.assertAlmostEqual(
            financial.NPV(0.08, range1) + -40000, 1922.06, 2)
        self.assertAlmostEqual(
            financial.NPV(0.08, range1, -9000) + -40000, -3749.47, 2)
Esempio n. 2
0
 def test_NPV_without_values(self):
     self.assertIsInstance(financial.NPV(3.4), xl.ValueExcelError)
Esempio n. 3
0
 def test_NPV_in_python_mode(self):
     self.assertAlmostEqual(financial.NPV(0.06, 1, 2, 3), 5.556781772872908)
     self.assertAlmostEqual(financial.NPV(0.06, 1), 1.0)