Skip to content

Conversation

@mattwthompson
Copy link
Member

Description

I'd like to make sure tests pass with both Pint 0.21 and 0.22, which was recently released.

Todos

Notable points that this PR has either accomplished or will accomplish.

  • TODO 1

Questions

  • Question1

Status

  • Ready to go

@codecov-commenter
Copy link

Codecov Report

Merging #67 (ed31fc3) into main (b5af837) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

@mattwthompson
Copy link
Member Author

Well, that's confusing.

>>> from openff.units import unit
>>> from openff.units.openmm import to_openmm
>>> x = unit.Quantity(1, "nanometer")
>>> to_openmm(x)
Quantity(value=1, unit=nanometer)
>>> x.to_openmm()
Traceback (most recent call last):
  File "/Users/mattthompson/mambaforge/envs/openff-units-test/lib/python3.10/site-packages/pint/facets/numpy/quantity.py", line 229, in __getattr__
    return getattr(self._magnitude, item)
AttributeError: 'int' object has no attribute 'to_openmm'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mattthompson/mambaforge/envs/openff-units-test/lib/python3.10/site-packages/pint/facets/numpy/quantity.py", line 231, in __getattr__
    raise AttributeError(
AttributeError: Neither Quantity object nor its magnitude (1) has attribute 'to_openmm'

@mattwthompson
Copy link
Member Author

I don't know why this way of monkey-patch works and the old way didn't. I'm scared to learn why.

https://github.com/hgrecco/pint/pull/1633/files

@mattwthompson mattwthompson marked this pull request as ready for review June 14, 2023 20:43
@mattwthompson mattwthompson merged commit f2f27a7 into main Jun 14, 2023
@mattwthompson mattwthompson deleted the pint-versions branch June 14, 2023 20:46
@mattwthompson mattwthompson mentioned this pull request Jun 19, 2023
3 tasks
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

Successfully merging this pull request may close these issues.

3 participants