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

Quantity from dict does not fail as expected #222

Open
cybercyber123 opened this issue May 23, 2023 · 0 comments
Open

Quantity from dict does not fail as expected #222

cybercyber123 opened this issue May 23, 2023 · 0 comments

Comments

@cybercyber123
Copy link

>>> import quantities as pq
>>> pq.__version__
'0.14.1'
>>> a = [{'x':3, 'y':4},{'x':3, 'y':4}]
>>> a * pq.m
Traceback (most recent call last):
  File ".../pycharm-2022.2.3/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
  File "<input>", line 1, in <module>
  File ".../PycharmProjects/quantities-bug/venv/lib/python3.10/site-packages/quantities/unitquantity.py", line 207, in __rmul__
    return self.view(Quantity).__rmul__(other)
  File ".../PycharmProjects/quantities-bug/venv/lib/python3.10/site-packages/quantities/quantity.py", line 341, in __rmul__
    return np.multiply(other, self)
TypeError: unsupported operand type(s) for *: 'dict' and 'float'
>>> pq.Quantity(a, pq.m)
array([{'x': 3, 'y': 4}, {'x': 3, 'y': 4}], dtype=object) * m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant