Skip to content

[ENH] early return for deep_equals in case of object identity#568

Merged
fkiraly merged 1 commit into
sktime:mainfrom
CloseChoice:fix-deep-equals
Jun 20, 2026
Merged

[ENH] early return for deep_equals in case of object identity#568
fkiraly merged 1 commit into
sktime:mainfrom
CloseChoice:fix-deep-equals

Conversation

@CloseChoice

Copy link
Copy Markdown
Contributor

This fixes the following problem

    from pytorch_forecasting.metrics.quantile import QuantileLoss
    import numpy as np

    a = QuantileLoss(quantiles=[0.1, 0.2])
    assert deep_equals(a, a)  # Fails

this fails since the QuantileLoss overwrites __eq__ and __ne__. I simulate this in a test that fails on main as well, in order to not introduce another heavy dependency.

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Does your contribution introduce a new dependency? If yes, which one?

What should a reviewer concentrate their feedback on?

Any other comments?

PR checklist

For all contributions
  • I've reviewed the project documentation on contributing
  • I've added myself to the list of contributors.
  • The PR title starts with either [ENH], [CI/CD], [MNT], [DOC], or [BUG] indicating whether
    the PR topic is related to enhancement, CI/CD, maintenance, documentation, or a bug.
For code contributions
  • Unit tests have been added covering code functionality
  • [ ] Appropriate docstrings have been added (see documentation standards)
  • [ ] New public functionality has been added to the API Reference

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.12%. Comparing base (306958d) to head (2b8b80b).
⚠️ Report is 213 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #568      +/-   ##
==========================================
- Coverage   85.07%   84.12%   -0.95%     
==========================================
  Files          45       52       +7     
  Lines        3015     3963     +948     
==========================================
+ Hits         2565     3334     +769     
- Misses        450      629     +179     

☔ View full report in Codecov by Harness.
📢 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.

@fkiraly fkiraly changed the title fix deep equals for custom objects [ENH] early return for deep_equals in case of object identity Jun 20, 2026
@fkiraly fkiraly added implementing framework Implementing core skbase framework enhancement Adding new functionality labels Jun 20, 2026

@fkiraly fkiraly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good suggestion.

@fkiraly fkiraly merged commit 22695ad into sktime:main Jun 20, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adding new functionality implementing framework Implementing core skbase framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants