Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fix-ordinary-calendar-year-sampling.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed test_ordinary_parameters_read_every_key_as_before, which drew some of its ordinary parameters from the household energy price indices, a calendar-year series.
15 changes: 10 additions & 5 deletions policyengine_uk/tests/test_process_time_reforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
LAGGED_CPI = f"{GROWTH}.obr.lagged_cpi"
INDICES = "gov.economic_assumptions.indices"
ENERGY_PRICES = "gov.economic_assumptions.energy_prices"
# The calendar-year series on the gov tree (invariant 2).
CALENDAR_YEAR_SERIES = (f"{GROWTH}.", f"{INDICES}.", f"{ENERGY_PRICES}.")
CPI_INDEX = f"{INDICES}.obr.consumer_price_index"
INPUTS = "gov.economic_assumptions.statutory_uprating_inputs"
AWE = f"{INPUTS}.awe_total_pay_may_july"
Expand Down Expand Up @@ -324,9 +326,7 @@ def test_calendar_year_series_are_the_growth_rates_indices_and_household_tree():
for path in paths:
if path.startswith("baseline."):
continue
expected = path.startswith(
(f"{GROWTH}.", f"{INDICES}.", f"{ENERGY_PRICES}.", "household.")
)
expected = path.startswith(CALENDAR_YEAR_SERIES + ("household.",))
assert reads(path) is expected, path
assert not reads("gov.not.a.parameter")

Expand Down Expand Up @@ -600,8 +600,7 @@ def statutory_leaves():
ORDINARY = [
path
for path in statutory_leaves()
if path.startswith("gov.")
and not path.startswith(("gov.economic_assumptions.yoy_growth.",))
if path.startswith("gov.") and not path.startswith(CALENDAR_YEAR_SERIES)
]
KEYS = st.one_of(
st.integers(2016, 2040),
Expand All @@ -613,6 +612,12 @@ def statutory_leaves():
)


def test_no_ordinary_parameter_reads_calendar_years():
reads = tbs_module.parameter_reads_calendar_years()
assert ORDINARY
assert [path for path in ORDINARY if reads(path)] == []


@settings(max_examples=200, deadline=None, derandomize=True)
@given(path=st.sampled_from(ORDINARY), key=KEYS)
def test_ordinary_parameters_read_every_key_as_before(path, key):
Expand Down
Loading