Skip to content

Add unit tests for group_contiguous_integers#210

Merged
derek73 merged 2 commits into
masterfrom
test/group-contiguous-integers
Jul 4, 2026
Merged

Add unit tests for group_contiguous_integers#210
derek73 merged 2 commits into
masterfrom
test/group-contiguous-integers

Conversation

@derek73

@derek73 derek73 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • group_contiguous_integers (nameparser/parser.py) is a pure, module-level utility used by join_on_conjunctions to find contiguous runs of conjunction indices, but had no direct test coverage — only indirect coverage through HumanName-level parsing tests.
  • Adds tests/test_parser_util.py with focused tests for its actual contract: empty input, isolated single values, the smallest valid run (an adjacent pair), a single run, multiple separate runs, isolated values between runs, and a note that it assumes ascending/strictly-increasing input (unsorted input isn't treated as contiguous).

Follow-up from #209, split out per review discussion since this function itself wasn't touched by that PR.

Test plan

  • python -m pytest tests/test_parser_util.py -v — 16 passed (8 tests × default/none config parametrization)
  • python -m pytest -q — 1272 passed, 4 skipped, 22 xfailed (up from 1256 baseline by exactly the 16 new test cases; zero regressions)

This module-level utility (used by join_on_conjunctions) had no
direct test coverage of its own, only indirect coverage through
HumanName-level parsing tests. Add focused tests for its documented
contract: empty/isolated/single values return no ranges, adjacent
pairs are the smallest valid run, multiple separate runs are found
independently, and out-of-order input isn't treated as contiguous
(the function assumes ascending, strictly increasing input).
@derek73 derek73 self-assigned this Jul 4, 2026
@derek73 derek73 added this to the v1.3.0 milestone Jul 4, 2026
Code review noted the comment attributed the empty result to
"unsorted input" generally, when the actual mechanism is that the
groupby key (enumerate index - value) only repeats across an
ascending run; a descending sequence changes the key at every step.
@derek73 derek73 merged commit b2f0cf2 into master Jul 4, 2026
8 checks passed
@derek73 derek73 deleted the test/group-contiguous-integers branch July 4, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant