Repository navigation
Fix isinstance checks in Temperature arithmetic operators - #571
Merged
lohedges merged 1 commit intoNov 27, 2026
Merged
Conversation
chenyangsu
temporarily deployed
to
biosimspace-build
November 27, 2026 09:20 — with
GitHub Actions
Inactive
chenyangsu
temporarily deployed
to
biosimspace-build
November 27, 2026 09:20 — with
GitHub Actions
Inactive
chenyangsu
temporarily deployed
to
biosimspace-build
November 27, 2026 09:20 — with
GitHub Actions
Inactive
chenyangsu
temporarily deployed
to
biosimspace-build
November 27, 2026 09:20 — with
GitHub Actions
Inactive
chenyangsu
temporarily deployed
to
biosimspace-build
November 27, 2026 09:20 — with
GitHub Actions
Inactive
Contributor
|
Many thanks. I've triggered the CI. |
lohedges
self-requested a review
November 27, 2026 09:45
lohedges
approved these changes
Nov 27, 2026
lohedges
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this. I'll sort out the inconsistencies in the comparisons on devel since they are present in a few other places too.
This branch was previously deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If this is to fix a bug...
Temperature(300.0, "K") + Temperature(10.0, "K"),Temperature(300.0, "K") - Temperature(10.0, "K"), andTemperature(25.0, "C") / Temperature(5.0, "C")(withallow_offset = True) raiseTypeError: isinstance() arg 2 must be a type, a tuple of types, or a union, becauseTemperature.__add__,__sub__, and__truediv__checkisinstance(other, self)instead ofisinstance(other, type(self))(unlike the baseTypeclass in_type.py, which checkstype(other) is type(self)).The fix updates those three checks to
isinstance(other, type(self))in bothBioSimSpace/Types/_temperature.pyandSandpit/Exscientia/Types/_temperature.py, and addstest_temperature_arithmeticto bothtest_types.pysuites. Happy to usetype(other) is type(self)to match_type.pyif you prefer.develinto this branch before issuing this pull request (e.g. by runninggit pull origin devel): [y]Suggested reviewers:
@lohedges, @chryswoods
Any additional context of information?
Testing: ran
tests/Types/test_types.pyandtests/Sandpit/Exscientia/Types/test_types.pyagainst a minimalsire.legacy.Unitsstub locally sincesireis not installed in this environment (12 passed; both new tests failed withTypeErrorbefore the fix);ruff checkandruff format --checkclean.