Skip to content
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

ufunc calls with mixed args and upcast types #951

Merged
merged 3 commits into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pint/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _to_magnitude(value, force_ndarray=False):

def is_upcast_type(other):
# Check if class name is in preset list
keewis marked this conversation as resolved.
Show resolved Hide resolved
return other.__class__.__name__ in ("PintArray", "Series", "DataArray")
return other.__name__ in ("PintArray", "Series", "DataArray")


def eq(first, second, check_all):
Expand Down
2 changes: 1 addition & 1 deletion pint/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def wrapped(self, *args, **kwargs):
def check_implemented(f):
def wrapped(self, *args, **kwargs):
other = args[0]
if is_upcast_type(other):
if is_upcast_type(type(other)):
return NotImplemented
# pandas often gets to arrays of quantities [ Q_(1,"m"), Q_(2,"m")]
# and expects Quantity * array[Quantity] should return NotImplemented
Expand Down
2 changes: 1 addition & 1 deletion pint/testsuite/test_babel.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_registry_locale(self):
self.assertEqual(time.format_babel(locale="ro", length="short"), "8.0 s")
acceleration = distance / time ** 2
self.assertEqual(
acceleration.format_babel(length="long"), "0.375 mètre par seconde²",
acceleration.format_babel(length="long"), "0.375 mètre par seconde²"
)
mks = ureg.get_system("mks")
self.assertEqual(mks.format_babel(locale="fr_FR"), "métrique")
Expand Down