Skip to content

Exclude separating lines from row index validation - #465

Open
kokotatan wants to merge 1 commit into
astanin:masterfrom
kokotatan:fix-indexed-separating-lines
Open

kokotatan wants to merge 1 commit into
astanin:masterfrom
kokotatan:fix-indexed-separating-lines

Conversation

@kokotatan

Copy link
Copy Markdown

Fixes #464

A sized custom showindex rejects valid input when SEPARATING_LINE rows are present because its length is compared with all display rows. A DataFrame's implicit index also shifts separator labels onto subsequent data rows.

This change checks sized indices against actual data rows, creates automatic indices with the same count, and filters DataFrame-owned labels alongside separator rows so each data row retains its original label. Explicit list/tuple indices contain one ID per data row; extra IDs previously accepted and silently discarded are now rejected.

The public regressions cover list, tuple, and iterator indices; single and multiple separators, including list-wrapped markers; shorter and longer indices; and DataFrame default/True/always indices. Literal table expectations verify both row labels and separators. Against the original source, 8 of the 11 cases fail and 3 controls pass.

Validation on Windows:

  • Full suite with NumPy, Pandas, and wcwidth: 393 passed, 1 skipped; original existing tests: 382 passed, 1 skipped.
  • Supported Python 3.10, 3.11, 3.12, 3.13, and 3.14 tox extra environments: each 393 passed, 1 skipped.
  • All configured pre-commit hooks passed, including Ruff 0.15.4 checks and formatting.

This fix preserves existing iterator length behavior and does not address the separate trailing-separator rendering problem.

AI assistance was used for investigation, implementation, and review. The failures and checks above were executed locally, and the final source received independent reviews before submission.

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.

Separating lines break sized row indices and shift DataFrame labels

1 participant