Skip to content

ENH: Check that test files provide minimal inputs #1166

@MImmesberger

Description

@MImmesberger

Is your feature request related to a problem?

Some test files probably contain unnecessary input columns, we should check that.

At GETTSIM-personas we use this check, probably easy to adapt for GETTSIM tests:

def test_persona_inputs_does_not_contain_unnecessary_inputs(year, persona_class):
    policy_date_str = f"{year}-01-01"
    persona = persona_class(policy_date_str=policy_date_str)
    root_nodes = main(
        main_target=MainTarget.labels.root_nodes,
        policy_date_str=policy_date_str,
        input_data=InputData.tree(persona.input_data_tree),
        tt_targets=TTTargets.tree(persona.tt_targets_tree),
        include_warn_nodes=False,
    )
    input_qnames = dt.flatten_to_qnames(persona.input_data_tree)
    unnecessary_inputs = set(input_qnames) - set(root_nodes) - {"hh_id", "p_id"}
    assert not unnecessary_inputs

Note that sometimes unnecessary inputs may be justified (e.g. keeping hh_id just to make the household structure clear).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions