Skip to content

Commit 0b83276

Browse files
Revert "Split units file into with and without dimensions files"
1 parent 9d9ec28 commit 0b83276

6 files changed

Lines changed: 1213 additions & 3685 deletions

File tree

test/test_dimension.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import tunits
2323
import tunits.core as core
24-
import tunits.units_with_dimension
2524

2625

2726
def _all_dimensions() -> Iterator[type[core.ValueWithDimension]]:
@@ -83,10 +82,10 @@ def test_arithmetic_ops_preserve_type_array(
8382

8483

8584
def test_division_type() -> None:
86-
t: tunits.Time = 3 * tunits.units_with_dimension.ns
85+
t: tunits.Time = 3 * tunits.ns
8786

8887
t = t / 2
89-
assert t == 1.5 * tunits.units_with_dimension.ns
88+
assert t == 1.5 * tunits.ns
9089

9190
assert isinstance(1 / t, tunits.Value)
9291

test/test_value_array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ def test_dimensionless_act_like_arrays() -> None:
9393
def test_repr() -> None:
9494
from tunits.units import km, kg, s
9595

96-
assert repr(s * []) == "ValueArray(array([], dtype=float64), 's')"
97-
assert repr(km * [2, 3]) == "ValueArray(array([2., 3.]), 'km')"
96+
assert repr(s * []) == "TimeArray(array([], dtype=float64), 's')"
97+
assert repr(km * [2, 3]) == "LengthArray(array([2., 3.]), 'km')"
9898
assert repr(km * kg * [3j]) == "ValueArray(array([0.+3.j]), 'kg*km')"
9999
assert repr(km**2 * [-1] / kg**3 * s) == "ValueArray(array([-1.]), 'km^2*s/kg^3')"
100100
assert repr(km ** (2 / 3.0) * [-1] / kg**3 * s) == "ValueArray(array([-1.]), 'km^(2/3)*s/kg^3')"
101101

102-
expected_repr = f"ValueArray({repr(np.array(range(50000), dtype=float))}, 'km')"
102+
expected_repr = f"LengthArray({repr(np.array(range(50000), dtype=float))}, 'km')"
103103
assert repr(list(range(50000)) * km) == expected_repr
104104

105105
# Fallback case.

test_perf/perf_testing_util.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@
2222

2323
import tunits
2424
from tunits import ValueWithDimension, ArrayWithDimension
25-
from tunits import units, units_with_dimension
25+
from tunits import units
2626
import tunits.core as core
2727

2828
_ALL_VALUES_WITH_DIMENSION = [
29-
obj
30-
for name in dir(units_with_dimension)
31-
if isinstance(obj := getattr(units_with_dimension, name), ValueWithDimension)
29+
obj for name in dir(units) if isinstance(obj := getattr(units, name), ValueWithDimension)
3230
]
3331

3432

tunits/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,3 @@
9696
)
9797

9898
from tunits.units import *
99-
import tunits.units_with_dimension

0 commit comments

Comments
 (0)