def test_expand_xd_errors():
    """
    One of several _expand_?D tests.
    """
    dct = dict()
    with pytest.raises(ValueError):
        Parameters._expand_1D(dct, inflate=False, inflation_rates=[],
                              num_years=10)
    with pytest.raises(ValueError):
        Parameters._expand_2D(dct, inflate=False, inflation_rates=[],
                              num_years=10)
Exemple #2
0
def test_expand_xd_errors():
    """
    One of several _expand_?D tests.
    """
    dct = dict()
    with pytest.raises(ValueError):
        Parameters._expand_1D(dct,
                              inflate=False,
                              inflation_rates=[],
                              num_years=10)
    with pytest.raises(ValueError):
        Parameters._expand_2D(dct,
                              inflate=False,
                              inflation_rates=[],
                              num_years=10)
def test_expand_1d_scalar():
    """
    One of several _expand_?D tests.
    """
    val = 10.0
    exp = np.array([val * math.pow(1.02, i) for i in range(0, 10)])
    res = Parameters._expand_1D(np.array([val]),
                                inflate=True, inflation_rates=[0.02] * 10,
                                num_years=10)
    assert np.allclose(exp, res, atol=0.01, rtol=0.0)
Exemple #4
0
def test_expand_1d_scalar():
    """
    One of several _expand_?D tests.
    """
    val = 10.0
    exp = np.array([val * math.pow(1.02, i) for i in range(0, 10)])
    res = Parameters._expand_1D(np.array([val]),
                                inflate=True,
                                inflation_rates=[0.02] * 10,
                                num_years=10)
    assert np.allclose(exp, res, atol=0.01, rtol=0.0)