Skip to content

Test parameter description punctuation, fix 178 violations (#340)#1664

Open
vahid-ahmadi wants to merge 1 commit intomainfrom
vahid-ahmadi/issue-340-description-punctuation
Open

Test parameter description punctuation, fix 178 violations (#340)#1664
vahid-ahmadi wants to merge 1 commit intomainfrom
vahid-ahmadi/issue-340-description-punctuation

Conversation

@vahid-ahmadi
Copy link
Copy Markdown
Collaborator

Summary

Closes #340 (and substantially addresses #339).

  • New structural test policyengine_uk/tests/test_parameter_descriptions.py asserts every parameter `description` field ends with a period.
  • Brings the existing 178 violating files into compliance with a one-shot mechanical edit (no semantic change).

Implementation notes

  • Multi-line descriptions are handled correctly. YAML folded scalars like

    ```yaml
    description: Percentage of the Married Couple's Allowance which is deductible from
    Income Tax Liability
    ```

    parse to a single string. The fixer locates the last continuation line and appends `.` there, so the sentence ends correctly (`...Income Tax Liability.`) — not mid-clause.

  • A handful of parameter files contain date-like keys that pyyaml's generic loader rejects with `year 0 is out of range`. The test catches `Exception` so pre-existing parse quirks don't block the assertion; PolicyEngine-core uses its own loader to read these at runtime.

Test plan

  • `pytest policyengine_uk/tests/test_parameter_descriptions.py -v` — passes.
  • `policyengine-core test policyengine_uk/tests/policy -c policyengine_uk` — 1000 passed (no regressions).
  • Manual smoke: `CountryTaxBenefitSystem` builds, sample parameter descriptions render with trailing period (e.g. `Bank of England base rate.`, `Maximum weekly Industrial Injuries Disablement Benefit; amount varies in 10% increments.`).

🤖 Generated with Claude Code

Adds `policyengine_uk/tests/test_parameter_descriptions.py` which asserts
every parameter `description` ends with a period — and brings the existing
178 parameter files into compliance. Multi-line descriptions are handled
by appending the period to the last continuation line so the sentence ends
correctly when YAML joins them.

Per #339, these descriptions surface in the UI and were inconsistent;
locking the convention in CI prevents drift going forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vahid-ahmadi vahid-ahmadi requested a review from MaxGhenis May 6, 2026 11:30
@vahid-ahmadi vahid-ahmadi self-assigned this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test for consistent period-ending of PolicyEngine descriptions

1 participant