Skip to content

Commit

Permalink
add test of all pairs of base units with G=1
Browse files Browse the repository at this point in the history
  • Loading branch information
adrn committed Oct 17, 2024
1 parent cfa0fb0 commit 35622cc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/unit/test_unitsystems.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test the `unxt.unitsystems` module."""

import itertools
import pickle
from dataclasses import dataclass
from pathlib import Path
Expand Down Expand Up @@ -229,3 +230,15 @@ def test_simulation_usys():

usys2 = unitsystem(DynamicalSimulationUnitSystemFlag, u.kpc, u.Msun, u.rad)
assert np.isclose((1 * usys2["time"]).to_value(u.Myr), 1 / np.sqrt(tmp_G.value))

base_units = (u.kpc, u.Myr, u.Msun, u.km / u.s)
for u1, u2 in itertools.product(base_units, base_units):
if u1 == u2:
continue

usys = unitsystem(DynamicalSimulationUnitSystemFlag, u1, u2)

# For now, just test retrieving all three base unit types:
usys["length"]
usys["mass"]
usys["time"]

0 comments on commit 35622cc

Please sign in to comment.