Skip to content

RuntimeWarning: invalid value encountered in divide — QBI / labor-supply variables (84 occurrences in policyengine.py test suite) #8216

@vahid-ahmadi

Description

@vahid-ahmadi

Running pytest tests --no-cov on PolicyEngine/policyengine.py@joss-paper produces 429 passes and 84 RuntimeWarning: invalid value encountered in divide warnings. All originate from policyengine_us, concentrated in QBI (qualified business income) and labor-supply variables.

These are not test failures, but they create significant noise in the test output and likely indicate division-by-zero in formulas that should be guarded with np.where / np.divide(where=...).

Related but more specific than:

Reproduction:

git clone https://github.com/PolicyEngine/policyengine.py
cd policyengine.py && git checkout joss-paper
pip install -e .
pytest tests --no-cov -W error::RuntimeWarning  # to surface them

Reported in the discussion on PolicyEngine/policyengine.py#264.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions