Skip to content

Test: improve coverage for clamp and intcomma - #511

Closed
Neuralman159 wants to merge 2 commits into
python-humanize:mainfrom
Neuralman159:test/improve-number-coverage
Closed

Neuralman159 wants to merge 2 commits into
python-humanize:mainfrom
Neuralman159:test/improve-number-coverage

Conversation

@Neuralman159

@Neuralman159 Neuralman159 commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary
Adds unit tests to improve test coverage in humanize.number.

Changes

  1. Added a test to verify that clamp() raises ValueError when an invalid format argument is provided;
  2. Added parameterized tests for intcomma() to verify number formatting with alternative thousands and decimal separators;
  3. Used pytest's monkeypatch fixture to test separator formatting independently of installed translations.

Test Coverage
Metric Before After
Overall coverage 98.75% 99.29%
Covered statements 554/561 557/561
Uncovered statements 7 4

Testing

  1. Test framework: pytest;
  2. Coverage tool: pytest-cov;
  3. All newly added test cases passed;
  4. No production code was modified.

@hugovk

hugovk commented Nov 12, 2026

Copy link
Copy Markdown
Member

What's "Lab2"?

@hugovk

hugovk commented Nov 12, 2026

Copy link
Copy Markdown
Member

Closing as duplicate of PR #492. See #512.

@hugovk hugovk closed this Nov 12, 2026
@Neuralman159 Neuralman159 changed the title Lab2, test: improve coverage for clamp and intcomma Test: improve coverage for clamp and intcomma Nov 12, 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.

2 participants