Equality Vs Identity#916
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #916 +/- ##
==========================================
- Coverage 95.96% 95.96% -0.01%
==========================================
Files 23 23
Lines 2208 2203 -5
==========================================
- Hits 2119 2114 -5
Misses 89 89 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d928e0a to
51e2b12
Compare
51e2b12 to
efb8ea0
Compare
efb8ea0 to
738c6fa
Compare
738c6fa to
b21a017
Compare
Fix a number of instances where Equality was being checked over Identity. While no bug currently existed, this pattern was could have caused an extremely hard to track down bug. ```python >>> 1 == True # Equality True >>> 1 is True # Identity False ``` Signed-off-by: Jim Fitzpatrick <jfitzpat@redhat.com>
b21a017 to
821394f
Compare
|
/override verify-3_widget_example |
|
@kryanbeane: Overrode contexts on behalf of kryanbeane: verify-3_widget_example DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
kryanbeane
left a comment
There was a problem hiding this comment.
thanks for the contribution Jim and apologies it took so long to get merged!
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kryanbeane The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
bc89f92
into
project-codeflare:main
In a number of location there were comparisons against
None, and boolean values that were using equality comparisons. This can lead to bugs caused by false positives. Bug of this nature are hard track down.While I could not track down an instance of the bug, this PR introduces the correct pattern of using identity comparisons to the code base. Hopefully, the pattern will be followed within future work, and no unexpected bugs arise.
Equality and Identity by example
In the repl equality and identity can easily be seen.
Classes defining a custom
__eq__()methods can have logic error that allowingNoneequality to be true.More on comparisons can be found at https://docs.python.org/3/reference/expressions.html#comparisons
Verification
There is no fundamental change to the logic. All tests should pass as expected.
Note: Locally I was not setup to run e2e tests.