Changes comparisons to use identity-comparison (is) for the singleton None, and value-comparison (==) for strings.
Why is the change necessary?
Python strings do not guarantee object identity for equal strings, so comparing self.type against a string using is might not have the intended effect. (In practice, since both values are short constant string literals from the same source file, it'll work … but it's bad practice, and generates both runtime warnings and linter warnings.)
Using is not None instead of != None is less important, but it's accepted Python style to use is/is not for the None singleton, and linters throw warnings on this as well.
Solution
How was this change tested?
tox tests/unit has the same number of failures after this change as before.
Pull Request Checklist
Please check all boxes (including N/A items)
Testing
[X] Unit tests added (no behavior change)
[X] Integration test added (not needed)
[X] Manual testing (not needed)
Documentation
[X] docs: No relevant docs
[X] docstrings: No changes to public API
Title and description
[X] Change type: Title is prefixed with change type: and follows conventional commits
[X] References: Indicate issues fixed via: Fixes #xxx (no issue created for this PR)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.
Description
Changes comparisons to use identity-comparison (
is
) for the singleton None, and value-comparison (==
) for strings.Why is the change necessary?
Python strings do not guarantee object identity for equal strings, so comparing
self.type
against a string usingis
might not have the intended effect. (In practice, since both values are short constant string literals from the same source file, it'll work … but it's bad practice, and generates both runtime warnings and linter warnings.)Using
is not None
instead of!= None
is less important, but it's accepted Python style to useis
/is not
for the None singleton, and linters throw warnings on this as well.Solution
How was this change tested?
tox tests/unit
has the same number of failures after this change as before.Pull Request Checklist
Please check all boxes (including N/A items)
Testing
[X] Unit tests added (no behavior change)
[X] Integration test added (not needed)
[X] Manual testing (not needed)
Documentation
[X] docs: No relevant docs
[X] docstrings: No changes to public API
Title and description
Fixes #xxx
(no issue created for this PR)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.