Skip to content

test: cover two-sided clamp boundaries - #429

Open
rudyy07 wants to merge 1 commit into
python-humanize:mainfrom
rudyy07:test/cover-two-sided-clamp-boundaries
Open

rudyy07 wants to merge 1 commit into
python-humanize:mainfrom
rudyy07:test/cover-two-sided-clamp-boundaries

Conversation

@rudyy07

@rudyy07 rudyy07 commented Oct 2, 2026

Copy link
Copy Markdown

Description

This PR adds test coverage for existing, previously untested two-sided range clamping and boundary conditions in humanize.clamp().

Covered Behaviour

  • Supplying both floor and ceil simultaneously.
  • Values within the range return the formatted value without a token.
  • Values below floor are clamped correctly when ceil is also provided.
  • Values above ceil are clamped correctly when floor is also provided.
  • Values exactly equal to floor or ceil remain un-tokenized.

Changes

  • Added 5 parameterized test cases to tests/test_number.py.
  • No production code was changed.
  • No configuration or infrastructure was changed.

Verification

  • Full test suite before changes: 746 passed, 110 skipped
  • New clamp tests: 16 passed
  • Full test suite after reverting the intentional regression: 751 passed, 110 skipped
  • Intentionally changing value > ceil to value >= ceil caused the new boundary test to fail, confirming that the test detects the regression.

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.

1 participant