Skip to content

Commit

Permalink
test: fix
Browse files Browse the repository at this point in the history
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
  • Loading branch information
nstarman committed Oct 22, 2024
1 parent 5468fcd commit 624c282
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
27 changes: 20 additions & 7 deletions tests/unit/test_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ def test_gt():
assert jnp.array_equal(q > Quantity(1, u.m), jnp.array([False, True, True]))

# Test with incompatible units
assert jnp.array_equal(q > Quantity(0, u.s), jnp.array([False, False, False]))
# TODO: better equinox exception matching
with pytest.raises(Exception): # noqa: B017, PT011
_ = q > Quantity(0, u.s)


def test_ge():
Expand All @@ -251,7 +253,9 @@ def test_ge():
assert jnp.array_equal(q >= Quantity(2, u.m), jnp.array([False, True, True]))

# Test with incompatible units
assert jnp.array_equal(q >= Quantity(0, u.s), jnp.array([False, False, False]))
# TODO: better equinox exception matching
with pytest.raises(Exception): # noqa: B017, PT011
_ = q >= Quantity(0, u.s)


def test_lt():
Expand All @@ -269,7 +273,9 @@ def test_lt():
assert jnp.array_equal(q < Quantity(2, u.m), jnp.array([True, False, False]))

# Test with incompatible units
assert jnp.array_equal(q < Quantity(0, u.s), jnp.array([False, False, False]))
# TODO: better equinox exception matching
with pytest.raises(Exception): # noqa: B017, PT011
_ = q < Quantity(0, u.s)


def test_le():
Expand All @@ -287,7 +293,9 @@ def test_le():
assert jnp.array_equal(q <= Quantity(2, u.m), jnp.array([True, True, False]))

# Test with incompatible units
assert jnp.array_equal(q <= Quantity(0, u.s), jnp.array([False, False, False]))
# TODO: better equinox exception matching
with pytest.raises(Exception): # noqa: B017, PT011
_ = q <= Quantity(0, u.s)


def test_eq():
Expand All @@ -305,7 +313,9 @@ def test_eq():
assert jnp.array_equal(q == Quantity(2, u.m), jnp.array([False, True, False]))

# Test with incompatible units
assert jnp.array_equal(q == Quantity(0, u.s), jnp.array([False, False, False]))
# TODO: better equinox exception matching
with pytest.raises(Exception): # noqa: B017, PT011
_ = q == Quantity(0, u.s)


def test_ne():
Expand All @@ -323,8 +333,11 @@ def test_ne():
assert jnp.array_equal(q != Quantity(2, u.m), jnp.array([True, False, True]))

# Test with incompatible units
assert jnp.array_equal(q != Quantity(0, u.s), jnp.array([True, True, True]))
assert jnp.array_equal(q != Quantity(4, u.s), jnp.array([True, True, True]))
# TODO: better equinox exception matching
with pytest.raises(Exception): # noqa: B017, PT011
_ = q != Quantity(0, u.s)
with pytest.raises(Exception): # noqa: B017, PT011
_ = q != Quantity(4, u.s)


def test_neg():
Expand Down
18 changes: 7 additions & 11 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 624c282

Please sign in to comment.