Skip to content

chore: Add dedicated PrimaryKeyError#17

Merged
MariusMerkleQC merged 3 commits intomainfrom
pk_error
Mar 19, 2026
Merged

chore: Add dedicated PrimaryKeyError#17
MariusMerkleQC merged 3 commits intomainfrom
pk_error

Conversation

@MariusMerkleQC
Copy link
Collaborator

@MariusMerkleQC MariusMerkleQC commented Mar 19, 2026

Motivation

Solves #16

Changes

  • Introduce a custom PrimaryKeyError exception in a new _exceptions.py file
  • Make the PrimaryKeyError easily importable: from diffly import PrimaryKeyError
  • Replace existing primary key errors "masked" as ValueError with PrimaryKeyError

@MariusMerkleQC MariusMerkleQC changed the title chore: Add dedicated PrimaryKeyError chore: Add dedicated PrimaryKeyError Mar 19, 2026
@github-actions github-actions bot added the chore label Mar 19, 2026
@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (fb90a0e) to head (ee3a10c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #17   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9        10    +1     
  Lines          704       707    +3     
=========================================
+ Hits           704       707    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated PrimaryKeyError exception to make primary-key-related failures in diffly easier to catch distinctly from generic ValueErrors (per issue #16).

Changes:

  • Introduces diffly.PrimaryKeyError (defined in a new internal module and re-exported at package level).
  • Updates DataFrameComparison/compare_frames primary key validation and “missing primary key” join checks to raise PrimaryKeyError.
  • Adjusts affected tests to expect PrimaryKeyError instead of ValueError.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
diffly/_exceptions.py Adds the new PrimaryKeyError exception type.
diffly/__init__.py Re-exports PrimaryKeyError to support from diffly import PrimaryKeyError.
diffly/comparison.py Replaces primary-key-related ValueError raises with PrimaryKeyError.
tests/test_dataframe_comparison.py Updates primary key validation tests to assert PrimaryKeyError.
tests/test_joined.py Updates missing-primary-key join test to assert PrimaryKeyError.
tests/test_fraction_same.py Updates missing-primary-key fraction_same test to assert PrimaryKeyError.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MariusMerkleQC MariusMerkleQC marked this pull request as ready for review March 19, 2026 13:17
Copy link
Collaborator

@EgeKaraismailogluQC EgeKaraismailogluQC left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@MariusMerkleQC MariusMerkleQC requested a review from borchero March 19, 2026 15:21
@MariusMerkleQC MariusMerkleQC merged commit 2ae4c11 into main Mar 19, 2026
18 checks passed
@MariusMerkleQC MariusMerkleQC deleted the pk_error branch March 19, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raise PrimaryKeyError instead of ValueError for primary key issues

4 participants