Skip to content

Commit 51e81a5

Browse files
committed
test/dates: assume NoUnits instead of MethodErrors in the case of Date types with ambiguous units
For example, Years are not always the same length, so they do not have unambiguous units. Many abstract Date types also do not have units.
1 parent 330869f commit 51e81a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/dates.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
@test_throws MethodError dimension(T(1))
1313
@test_throws MethodError Unitful.numtype(T)
1414
@test_throws MethodError Unitful.numtype(T(1))
15-
@test_throws MethodError unit(T)
16-
@test_throws MethodError unit(T(1))
15+
@test unit(T) == NoUnits
16+
@test unit(T(1)) == NoUnits
1717
end
1818

1919
for p = (CompoundPeriod, CompoundPeriod(), CompoundPeriod(Day(1)), CompoundPeriod(Day(1), Hour(-1)))
2020
@test dimension(p) === 𝐓
2121
@test_throws MethodError Unitful.numtype(p)
22-
@test_throws MethodError unit(p)
22+
@test unit(p) == NoUnits
2323
end
2424
end
2525

0 commit comments

Comments
 (0)