def test_yield_errors() -> None: with pytest.raises(ValueError) as e: # < lower bound ple = dca.PLE(-1000, 0.8, 0.0, 0.5) with pytest.raises(ValueError) as e: # lower bound excluded tplehm = dca.PLE(1000, 0.8, 0.0, 0.0) with pytest.raises(ValueError) as e: # > upper bound thm = dca.THM(1000, 0.5, 2.0, 10.0, 30.0) with pytest.raises(ValueError) as e: # upper bound exluded thm = dca.THM(1000, 1.5, 2.0, 0.5, 30.0) with pytest.raises(KeyError) as e: # invalid parameter thm = dca.THM(1000, 0.5, 2.0, 0.5, 30.0) thm.get_param_desc('n') with pytest.raises(ValueError) as e: # invalid parameter sequence length thm = dca.THM.from_params([1000, 0.5, 2.0, 0.5])
def test_terminal_exceeds() -> None: with pytest.raises(ValueError) as e: # Dinf > Di ple = dca.PLE(1000, 0.8, 0.9, 0.5) with pytest.raises(ValueError) as e: # Dterm > Di mh = dca.MH(1000, 0.5, 1.0, 0.9) with pytest.raises(ValueError) as e: # bf > bi thm = dca.THM(1000, 0.8, 1.5, 1.6, 30.0) with pytest.raises(ValueError) as e: # tterm < telf thm = dca.THM(1000, 0.8, 2.0, 1.0, 200.0, 0.3, 100.0 / dca.DAYS_PER_YEAR)
def test_PLE(qi: float, Di: float, Dinf: float, n: float) -> None: assume(Dinf <= Di) ple = dca.PLE.from_params((qi, Di, Dinf, n)) ple = dca.PLE(qi, Di, Dinf, n) check_model(ple, qi)
D_thm = thm.D(ftime) b_thm = thm.b(ftime) beta_thm = thm.beta(ftime) # mh = dca.MH(qi=725, Di=0.85, bi=0.6, Dterm=0.2) q_mh = mh.rate(ftime) N_mh = mh.cum(ftime) N_mh = mh.monthly_vol(ftime) N_mh = mh.interval_vol(ftime) D_mh = mh.D(ftime) b_mh = mh.b(ftime) beta_mh = mh.beta(ftime) # ple = dca.PLE(qi=750, Di=.1, Dinf=.00001, n=.5) q_ple = ple.rate(ftime) N_ple = ple.cum(ftime) N_ple = ple.monthly_vol(ftime) N_ple = ple.interval_vol(ftime) D_ple = ple.D(ftime) b_ple = ple.b(ftime) beta_ple = ple.beta(ftime) # se = dca.SE(qi=715, tau=90.0, n=.5) q_se = se.rate(ftime) N_se = se.cum(ftime) N_se = se.monthly_vol(ftime) N_se = se.interval_vol(ftime) D_se = se.D(ftime)