File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Align Stage 1 validators with the central dataset export and calibration target contracts.
Original file line number Diff line number Diff line change 1313import numpy as np
1414import pytest
1515from policyengine_us_data .datasets .cps .extended_cps import ExtendedCPS_2024
16+ from policyengine_us_data .utils .dataset_validation import (
17+ STRUCTURAL_COMPUTED_EXPORT_VARIABLES ,
18+ )
1619
1720KNOWN_FORMULA_EXCEPTIONS = {
18- "person_id" ,
1921 "interest_deduction" ,
2022 "self_employed_health_insurance_ald" ,
2123 "self_employed_pension_contribution_ald" ,
22- }
24+ } | STRUCTURAL_COMPUTED_EXPORT_VARIABLES
2325
2426
2527@pytest .fixture (scope = "module" )
Original file line number Diff line number Diff line change 33import sqlite3
44
55import pytest
6+ from policyengine_us_data .utils .target_variables import target_variable_is_valid
67
78from policyengine_us_data .storage import STORAGE_FOLDER
89
@@ -322,14 +323,16 @@ def test_congressional_district_strata(built_db):
322323
323324
324325def test_all_target_variables_exist_in_policyengine (built_db ):
325- """Every target variable must be a valid policyengine-us variable ."""
326+ """Every target variable/expression must use policyengine-us variables ."""
326327 from policyengine_us .system import system
327328
328329 conn = sqlite3 .connect (str (built_db ))
329330 variables = {r [0 ] for r in conn .execute ("SELECT DISTINCT variable FROM targets" )}
330331 conn .close ()
331332
332- missing = [v for v in variables if v not in system .variables ]
333+ missing = sorted (
334+ v for v in variables if not target_variable_is_valid (v , system .variables )
335+ )
333336 assert not missing , f"Target variables not in policyengine-us: { missing } "
334337
335338
You can’t perform that action at this time.
0 commit comments