Beispiel #1
0
 def test_prob_rate_conversions1c(self):
     new = dcs.Units.convert(0.5, dcs.Units.MP, dcs.Units.AR)
     exp = dcs.prob_to_rate(dcs.convert_monthly_to_annual_probability(0.5))
     self.assertEqual(new, exp)
Beispiel #2
0
 def test_circular(self):
     annual = dcs.convert_monthly_to_annual_probability(self.monthly)
     np.testing.assert_array_almost_equal(annual, self.annuals)
     monthly = dcs.convert_annual_to_monthly_probability(annual)
     np.testing.assert_array_almost_equal(monthly, self.monthly)
Beispiel #3
0
 def test_prob_rate_conversions1c(self):
     new = dcs.Units.convert(0.5, dcs.Units.MP, dcs.Units.AR)
     exp = dcs.prob_to_rate(dcs.convert_monthly_to_annual_probability(0.5))
     self.assertEqual(new, exp)
Beispiel #4
0
 def test_lt_zero(self):
     with self.assertRaises(ValueError):
         dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, -1.]))
Beispiel #5
0
 def test_gt_one(self):
     with self.assertRaises(ValueError):
         dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, 1.5]))
Beispiel #6
0
 def test_conversion(self):
     annual = dcs.convert_monthly_to_annual_probability(self.monthly)
     np.testing.assert_array_almost_equal(annual, self.annuals)
Beispiel #7
0
 def test_scalar(self):
     annual = dcs.convert_monthly_to_annual_probability(0)
     self.assertIn(annual, self.annuals)
Beispiel #8
0
 def test_circular(self):
     annual = dcs.convert_monthly_to_annual_probability(self.monthly)
     np.testing.assert_array_almost_equal(annual, self.annuals)
     monthly = dcs.convert_annual_to_monthly_probability(annual)
     np.testing.assert_array_almost_equal(monthly, self.monthly)
Beispiel #9
0
 def test_gt_one(self):
     with self.assertRaises(ValueError):
         dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, 1.5]))
Beispiel #10
0
 def test_lt_zero(self):
     with self.assertRaises(ValueError):
         dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, -1.]))
Beispiel #11
0
 def test_scalar(self):
     annual = dcs.convert_monthly_to_annual_probability(0)
     self.assertIn(annual, self.annuals)
Beispiel #12
0
 def test_conversion(self):
     annual = dcs.convert_monthly_to_annual_probability(self.monthly)
     np.testing.assert_array_almost_equal(annual, self.annuals)