Skip to content

Commit

Permalink
test added to check the conversion of lists between pint and openmm.unit
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Mar 13, 2022
1 parent b4d563a commit 608eb1e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pyunitwizard/tests/pint/test_convert_with_pint.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import pyunitwizard as puw
import numpy as np

## from string

Expand Down Expand Up @@ -108,3 +109,13 @@ def test_to_openmm_unit_1():
q_true = 2.5 * openmm_unit.nanometer/openmm_unit.picosecond
assert q == q_true

def test_to_openmm_unit_2():
puw.configure.reset()
puw.configure.load_library(['pint','openmm.unit'])
ureg = puw.forms.api_pint.ureg
openmm_unit = puw.forms.api_openmm_unit.openmm_unit
q = ureg.Quantity([[0,0], [0,0]], 'nanometers/picoseconds')
q = puw.convert(q, to_form='openmm.unit')
q_true = [[0,0], [0,0]] * openmm_unit.nanometer/openmm_unit.picosecond
assert np.all(q == q_true)

0 comments on commit 608eb1e

Please sign in to comment.