-
Notifications
You must be signed in to change notification settings - Fork 93
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
Changed __repr__ in BinnedSpikeTrain to support quantities<0.12.4 #418
Changed __repr__ in BinnedSpikeTrain to support quantities<0.12.4 #418
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can approve these changes.
Little side-note: it is maybe IDE dependent, but when i run test_conversion.test_repr in Pycharm to recreate the bug #409, the self.assertEqual() function might expect as first parameter the desired value and secondly the actual value. Because in the respective debug-message, the order is switched to
Expected: string generated by repr()
Actual: hardcoded reference string
This is a PyCharm issue, as it is known that its diff tool provides these If running the tests using the command line, the standard
|
Ok, so then i can approve the pull-request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes prevent test_converstion.test_repr()-failure for quantities version <= 0.12.3 and should be adopted.
The unit test for method
__repr__
inconversion.BinnedSpikeTrain
fails ifquantities
is0.12.3
or below.The old method was using
Quantity
scalars inside an f-string. This required the__format__
method implemented inquantities==0.12.4
to generate the correct string representation ofBinnedSpikeTrain
with magnitudes and units.This PR changes the string generation by casting the
Quantity
scalars to string, which uses the__str__
method inQuantity
and displays the magnitudes and units as expected. This does not rely on any formatting method and thereby it is compatible with older versions ofquantities
.This addresses issue #409.