Title: Test failure in test_umath.py::TestUmath::test_fix with NumPy 2.4 · Issue #266 · python-quantities/python-quantities · GitHub
Open Graph Title: Test failure in test_umath.py::TestUmath::test_fix with NumPy 2.4 · Issue #266 · python-quantities/python-quantities
X Title: Test failure in test_umath.py::TestUmath::test_fix with NumPy 2.4 · Issue #266 · python-quantities/python-quantities
Description: quantities/tests/test_umath.py F >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
Open Graph Description: quantities/tests/test_umath.py F >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
X Description: quantities/tests/test_umath.py F >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...
Opengraph URL: https://github.com/python-quantities/python-quantities/issues/266
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Test failure in test_umath.py::TestUmath::test_fix with NumPy 2.4","articleBody":"```\nquantities/tests/test_umath.py F\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e traceback \u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\u003e\n\nself = array(3.14) * degF, obj = array(3.), context = (\u003cufunc 'trunc'\u003e, (array(3.14) * degF,), 0)\n\n def __array_prepare__(self, obj, context=None):\n if self.__array_priority__ \u003e= Quantity.__array_priority__:\n res = obj if isinstance(obj, type(self)) else obj.view(type(self))\n else:\n # don't want a UnitQuantity\n res = obj.view(Quantity)\n if context is None:\n return res\n\n uf, objs, huh = context\n if uf.__name__.startswith('is'):\n return obj\n\n try:\n\u003e res._dimensionality = p_dict[uf](*objs)\n ^^^^^^^^^^\nE KeyError: \u003cufunc 'trunc'\u003e\n\nquantities/quantity.py:311: KeyError\n\nDuring handling of the above exception, another exception occurred:\n\nself = \u003cquantities.tests.test_umath.TestUmath testMethod=test_fix\u003e\n\n def test_fix(self):\n\u003e self.assertQuantityEqual(np.fix(3.14 * pq.degF), 3.0 * pq.degF)\n ^^^^^^^^^^^^^^^^^^^^^^\n\nquantities/tests/test_umath.py:163:\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n../env-202601/lib/python3.14/site-packages/numpy/lib/_ufunclike_impl.py:59: in fix\n return nx.trunc(x, out=out)\n ^^^^^^^^^^^^^^^^^^^^\nquantities/quantity.py:331: in __array_wrap__\n return self.__array_prepare__(obj, context)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\nself = array(3.14) * degF, obj = array(3.), context = (\u003cufunc 'trunc'\u003e, (array(3.14) * degF,), 0)\n\n def __array_prepare__(self, obj, context=None):\n if self.__array_priority__ \u003e= Quantity.__array_priority__:\n res = obj if isinstance(obj, type(self)) else obj.view(type(self))\n else:\n # don't want a UnitQuantity\n res = obj.view(Quantity)\n if context is None:\n return res\n\n uf, objs, huh = context\n if uf.__name__.startswith('is'):\n return obj\n\n try:\n res._dimensionality = p_dict[uf](*objs)\n except KeyError:\n\u003e raise ValueError(\n \"\"\"ufunc %r not supported by quantities\n please file a bug report at https://github.com/python-quantities\n \"\"\" % uf\n )\nE ValueError: ufunc \u003cufunc 'trunc'\u003e not supported by quantities\nE please file a bug report at https://github.com/python-quantities\n\nquantities/quantity.py:313: ValueError\n```\n\nThis seems to be because the implementation of np.fix was changed in NumPy 2.4 to use `trunc` ([v2.3.5](https://github.com/numpy/numpy/blob/c3d60fc8393f3ca3306b8ce8b6453d43737e3d90/numpy/lib/_ufunclike_impl.py#L17) [v2.4.0](https://github.com/numpy/numpy/blob/c5ab79c14c98bfda1e60770ffa23a6130f8267b7/numpy/lib/_ufunclike_impl.py#L17))","author":{"url":"https://github.com/apdavison","@type":"Person","name":"apdavison"},"datePublished":"2026-01-12T16:33:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/266/python-quantities/issues/266"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4e7ac50b-daa1-6d06-e6f9-522c2e401c5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B73C:231D79:13237BE:198F0EE:696AD8E1 |
| html-safe-nonce | 7ed7f9e385f39122c77bdc8efcb095dd2e16011edd21c8a990691f90aa53df20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzNDOjIzMUQ3OToxMzIzN0JFOjE5OEYwRUU6Njk2QUQ4RTEiLCJ2aXNpdG9yX2lkIjoiNTMyNjE1MjI0OTMzNzYzMjk5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f153c663ba50ba99d22e4b06aba15971d4245fb1a8ffb42c206ded281bea2737 |
| hovercard-subject-tag | issue:3805078990 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-quantities/python-quantities/266/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b44df1d5326c5f434786f694ed656e14fae855b9f16e0966ced59c5692bbbeb6/python-quantities/python-quantities/issues/266 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b44df1d5326c5f434786f694ed656e14fae855b9f16e0966ced59c5692bbbeb6/python-quantities/python-quantities/issues/266 |
| og:image:alt | quantities/tests/test_umath.py F >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | apdavison |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python-quantities/python-quantities git https://github.com/python-quantities/python-quantities.git |
| octolytics-dimension-user_id | 222003 |
| octolytics-dimension-user_login | python-quantities |
| octolytics-dimension-repository_id | 560911 |
| octolytics-dimension-repository_nwo | python-quantities/python-quantities |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 560911 |
| octolytics-dimension-repository_network_root_nwo | python-quantities/python-quantities |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 524a93f2c1f36522a3b4be4c110467ee4172245d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width