-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up framework for an
assert_equal
function (#5634)
**Context:** While `qml.equal` has been incredibly helpful in helping us compare operators, measurements, and tapes, it can sometimes be rather difficult to determine *why* two operations are not equal. This new `assert_equal` function will raise and `AssertionError` with context, making it easier to debug failures occuring in tests or scripts. **Description of the Change:** This PR just sets up the framework by: 1) Allowing the `_equal` function to return either a bool or str. 2) Making `qml.equal` interpret a string as `False` 3) Adding `assert_equal` to raise an `AssertionError` from the output of `_equal` 4) Implementing the bool-> str conversion for `BasisRotation` `BasisRotation` is as it an edge case where I can demonstrate what we want these functions to look like without taking away the core part of the work. **Benefits:** Easier debugging. **Possible Drawbacks:** More to maintain. **Related GitHub Issues:** --------- Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
148 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters