Skip to content

Commit b5c32f7

Browse files
Change the default units to their dimensional version (#82)
the units exported at the top level of tunits didn't have the dimension information because of backwards compatibility ... this PR changes that part of b/411725412
2 parents deb2cf6 + 84912f9 commit b5c32f7

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

test/cirq_compatibility.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_to_json() -> None:
2222
assert (
2323
cirq.to_json(tu.ns * 3)
2424
== """{
25-
"cirq_type": "tunits.Value",
25+
"cirq_type": "tunits.Time",
2626
"value": 3,
2727
"unit": "ns"
2828
}"""
@@ -31,7 +31,7 @@ def test_to_json() -> None:
3131
assert (
3232
cirq.to_json(tu.GHz * [1, 2, 3, -1])
3333
== """{
34-
"cirq_type": "tunits.ValueArray",
34+
"cirq_type": "tunits.FrequencyArray",
3535
"value": [
3636
1.0,
3737
2.0,

test/test_value.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ def test_format() -> None:
283283
assert f'{x:0.2f}' == '0.42 ns'
284284
assert f'{x:e}' == '4.234324e-01 ns'
285285

286-
x = 42.235 * tu.GHz
287-
assert f'{x:0.2f}' == '42.23 GHz'
288-
assert f'{x:0.1e}' == '4.2e+01 GHz'
286+
y = 42.235 * tu.GHz
287+
assert f'{y:0.2f}' == '42.23 GHz'
288+
assert f'{y:0.1e}' == '4.2e+01 GHz'
289289

290290
assert f'{tu.GHz}' == 'GHz'
291291
assert f'{2*tu.GHz}' == '2 GHz'

tunits/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@
9898
from tunits import units as units
9999
from tunits import units_with_dimension as units_with_dimension
100100

101-
from tunits.units import *
101+
from tunits.units_with_dimension import *

0 commit comments

Comments
 (0)