Example #1
0
 def test_circular(self):
     prob = dcs.annual_rate_to_monthly_probability(self.rate)
     np.testing.assert_array_almost_equal(prob, self.prob)
     rate = dcs.monthly_probability_to_annual_rate(prob)
     np.testing.assert_array_almost_equal(rate, self.rate)
Example #2
0
 def test_lt_zero(self):
     with self.assertRaises(ValueError):
         dcs.annual_rate_to_monthly_probability(np.array([0., 0.5, -1.]))
Example #3
0
 def test_infinity(self):
     prob = dcs.annual_rate_to_monthly_probability(np.inf)
     self.assertAlmostEqual(prob, 1.)
Example #4
0
 def test_conversion(self):
     prob = dcs.annual_rate_to_monthly_probability(self.rate)
     np.testing.assert_array_almost_equal(prob, self.prob)
Example #5
0
 def test_scalar(self):
     prob = dcs.annual_rate_to_monthly_probability(0)
     self.assertIn(prob, self.prob)
Example #6
0
 def test_circular(self):
     prob = dcs.annual_rate_to_monthly_probability(self.rate)
     np.testing.assert_array_almost_equal(prob, self.prob)
     rate = dcs.monthly_probability_to_annual_rate(prob)
     np.testing.assert_array_almost_equal(rate, self.rate)
Example #7
0
 def test_infinity(self):
     prob = dcs.annual_rate_to_monthly_probability(np.inf)
     self.assertAlmostEqual(prob, 1.)
Example #8
0
 def test_lt_zero(self):
     with self.assertRaises(ValueError):
         dcs.annual_rate_to_monthly_probability(np.array([0., 0.5, -1.]))
Example #9
0
 def test_scalar(self):
     prob = dcs.annual_rate_to_monthly_probability(0)
     self.assertIn(prob, self.prob)
Example #10
0
 def test_conversion(self):
     prob = dcs.annual_rate_to_monthly_probability(self.rate)
     np.testing.assert_array_almost_equal(prob, self.prob)