Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement assert equal for operators #5780

Merged
merged 34 commits into from
Jun 12, 2024

Conversation

Tarun-Kumar07
Copy link
Contributor

@Tarun-Kumar07 Tarun-Kumar07 commented May 31, 2024

Context:
PennyLane currently has a qml.equal function which can be used to check the equality of operators, measurements, and tapes. New framework assert_equal has been developed which along with checking equality tells the reason for equality failure.

Description of the Change:

  • Implement support for assert_equal for different type of operators mentioned in #5644 and #5648
  • Implementation for the above has been changed such that the negative paths return error messages.
  • Existing unit tests have been updated to verify the error message.

Benefits:
assert_equals for mentioned operators above return more granular reason of failure. This eases debugging of tests.

Possible Drawbacks:
More maintenance

Related GitHub Issues:
Fixes #5644
Fixes #5648

Copy link

codecov bot commented Jun 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (d5f6313) to head (fd2339c).
Report is 252 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5780      +/-   ##
==========================================
- Coverage   99.67%   99.67%   -0.01%     
==========================================
  Files         420      420              
  Lines       40084    39842     -242     
==========================================
- Hits        39955    39713     -242     
  Misses        129      129              

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

@Tarun-Kumar07 Tarun-Kumar07 marked this pull request as ready for review June 1, 2024 13:07
@Tarun-Kumar07 Tarun-Kumar07 changed the title Improve assert equal Implement assert equal for operators Jun 1, 2024
@trbromley trbromley requested a review from albi3ro June 5, 2024 15:52
@mudit2812 mudit2812 self-requested a review June 11, 2024 13:21
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

This is looking great! I actually don't have any comments 🎉

Sorry about taking so long to get to this review...

I'm really looking forward to starting to use this in testing and debugging. It's going to be so much easier to trouble shoot.

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

Looks great! I'll approve once the below comments are addressed and CI continues to pass afterwards 😄

pennylane/ops/functions/equal.py Outdated Show resolved Hide resolved
pennylane/ops/functions/equal.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mudit2812 mudit2812 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 😄

@isaacdevlugt
Copy link
Contributor

Nice work everyone! 🎉

Just to clarify, @Tarun-Kumar07 and @EuGig how much would both of you say that you contributed to this PR?

@Tarun-Kumar07
Copy link
Contributor Author

Hey @isaacdevlugt , all the changes in this PR were done by me :)

@trbromley trbromley enabled auto-merge (squash) June 12, 2024 13:13
@trbromley trbromley disabled auto-merge June 12, 2024 13:31
@Tarun-Kumar07
Copy link
Contributor Author

Hi @trbromley,

I noticed that the auto-merge was disabled. Is everything okay?

@isaacdevlugt
Copy link
Contributor

Hey @Tarun-Kumar07, no concerns here 😄. We will merge your PR by the end of the day (around 5pm ET).

@trbromley trbromley enabled auto-merge (squash) June 12, 2024 21:01
@trbromley trbromley merged commit 45f8d4a into PennyLaneAI:master Jun 12, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants