diff --git a/Project.toml b/Project.toml index 88aceb0055..7aa31fb600 100644 --- a/Project.toml +++ b/Project.toml @@ -73,7 +73,7 @@ Distributed = "1" Distributions = "0.23, 0.24, 0.25" DocStringExtensions = "0.7, 0.8, 0.9" DomainSets = "0.6" -DynamicQuantities = "0.8" +DynamicQuantities = "0.8, 0.9, 0.10" ForwardDiff = "0.10.3" FunctionWrappersWrappers = "0.1" Graphs = "1.5.2" diff --git a/src/systems/unit_check.jl b/src/systems/unit_check.jl index ac73bb24c9..02567fa6a9 100644 --- a/src/systems/unit_check.jl +++ b/src/systems/unit_check.jl @@ -19,7 +19,8 @@ function __get_literal_unit(x) return nothing end v = value(x) - getmetadata(v, VariableUnit, nothing) + u = getmetadata(v, VariableUnit, nothing) + u === nothing ? nothing : screen_unit(u) end function __get_scalar_unit_type(v) u = __get_literal_unit(v) diff --git a/test/dq_units.jl b/test/dq_units.jl index d0dc2b0bb4..406292a344 100644 --- a/test/dq_units.jl +++ b/test/dq_units.jl @@ -59,16 +59,11 @@ end end @named p1 = Pin() @named p2 = Pin() -@named op = OtherPin() +@test_throws MT.ValidationError @named op = OtherPin() @named lp = LongPin() good_eqs = [connect(p1, p2)] -bad_eqs = [connect(p1, p2, op)] -bad_length_eqs = [connect(op, lp)] @test MT.validate(good_eqs) -@test !MT.validate(bad_eqs) -@test !MT.validate(bad_length_eqs) @named sys = ODESystem(good_eqs, t, [], []) -@test_throws MT.ValidationError ODESystem(bad_eqs, t, [], []; name = :sys) # Array variables @variables t [unit = u"s"] x(t)[1:3] [unit = u"m"]