Skip to content

test(ddxdb): compare rows with approx as dicts, as pytest 9.2 requires - #215

Merged
alxmrs merged 1 commit into
mainfrom
fix/pytest-92-approx
Oct 28, 2026
Merged

alxmrs merged 1 commit into
mainfrom
fix/pytest-92-approx

Conversation

@alxmrs

@alxmrs alxmrs commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Why

pytest 9.2.0, released 2026-10-27, raises TypeError: pytest.approx() does not support nested data structures. Seven ddxdb assertions compared a list of (key, value) pairs with approx. CI installs the newest pytest (pytest>=7), so ddxdb's wheel jobs fail on every PR, as they do on #214.

How

Each of the seven compares dict(pairs(...)) with approx of a dict instead, as the other ddxdb tests already do. Tests only.

Tests

Under pytest 9.2.0, main's ddxdb tests have 7 failures. This branch's pass (116 passed, 1 xfailed).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CvszJhH8pn8H9G69wEPMU2

Summary by CodeRabbit

  • Tests
    • Updated validation for gradient, Hessian-vector-product, and DuckDB query results to compare values by row ID, avoiding reliance on row ordering.
    • Existing expected values and tolerances remain unchanged.

pytest 9.2.0 (released 2026-10-27) raises TypeError on approx of nested
data, such as a list of (key, value) pairs, which seven assertions used.
Each now compares dict(pairs(...)) with approx of a dict, as the other
tests already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CvszJhH8pn8H9G69wEPMU2
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e659f4ae-a220-4252-bf13-37447a00bfe2
Commits

Reviewing files that changed from the base of the PR and between e543eb2 and 1aa62e2.

Files selected for processing: 2
  • python/ddxdb/tests/test_ad.py
  • python/ddxdb/tests/test_duckdb.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Six test assertions now compare keyed row values as dictionaries instead of ordered lists of pairs. The expected values remain unchanged.

Changes: Test assertion updates

Layer / File(s) Summary
Keyed result assertions
python/ddxdb/tests/test_ad.py, python/ddxdb/tests/test_duckdb.py
Gradient and Hessian-vector-product tests, plus DuckDB tests, compare keyed results as dictionaries. Expected values remain unchanged.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

  • xqlsystems/ddx#192: Added DuckDB shared-loss tests whose assertions this PR changes to dictionary comparisons.
  • xqlsystems/ddx#200: Added the window-differentiation and documentation-example tests whose assertions this PR changes to dictionary comparisons.

Suggested labels: testing

Merge Risk: Minimal · up to 1aa62

The PR only adjusts test comparison semantics and introduces no established merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: updating ddxdb tests to compare rows as dictionaries with pytest.approx for pytest 9.2 compatibility.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@alxmrs alxmrs left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@alxmrs
alxmrs merged commit 2cec740 into main Oct 28, 2026
16 checks passed
@alxmrs
alxmrs deleted the fix/pytest-92-approx branch October 28, 2026 00:10
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