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)
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)
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)
def test_lt_zero(self): with self.assertRaises(ValueError): dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, -1.]))
def test_gt_one(self): with self.assertRaises(ValueError): dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, 1.5]))
def test_conversion(self): annual = dcs.convert_monthly_to_annual_probability(self.monthly) np.testing.assert_array_almost_equal(annual, self.annuals)
def test_scalar(self): annual = dcs.convert_monthly_to_annual_probability(0) self.assertIn(annual, self.annuals)
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)
def test_gt_one(self): with self.assertRaises(ValueError): dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, 1.5]))
def test_lt_zero(self): with self.assertRaises(ValueError): dcs.convert_monthly_to_annual_probability(np.array([0., 0.5, -1.]))
def test_scalar(self): annual = dcs.convert_monthly_to_annual_probability(0) self.assertIn(annual, self.annuals)
def test_conversion(self): annual = dcs.convert_monthly_to_annual_probability(self.monthly) np.testing.assert_array_almost_equal(annual, self.annuals)