Skip to content

Commit 98f7fb6

Browse files
authored
fix tests on nightly (#283)
1 parent 63d72c4 commit 98f7fb6

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/schema.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ function concrete_term(t::Term, xs::AbstractArray, contrasts::AbstractContrasts)
215215
CategoricalTerm(t.sym, contrmat)
216216
end
217217

218+
# this catches early when someone provides `:x => DummyCoding` as a hint
219+
function concrete_term(t::Term, xs::AbstractArray, ::Type{T}) where {T<:AbstractContrasts}
220+
throw(ArgumentError("contrast types must be instantiated (use $T() instead of $T)"))
221+
end
222+
218223
"""
219224
apply_schema(t, schema::StatsModels.Schema[, Mod::Type = Nothing])
220225

test/contrasts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198

199199
# contrasts types must be instantiated (should throw ArgumentError, currently
200200
# MethodError on apply_schema)
201-
@test_broken setcontrasts!(mf, x = DummyCoding)
201+
@test_throws ArgumentError setcontrasts!(mf, x = DummyCoding)
202202

203203
@testset "hypothesis coding" begin
204204

test/formula.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@
118118
@formula(foo ~ bar + baz)
119119

120120
# drop_term no longer checks for whether term is found...
121-
@test_broken drop_term(@formula(foo ~ bar + baz), term(0))
122-
@test_broken drop_term(@formula(foo ~ bar + baz), term(:boz))
121+
f = @formula(foo ~ bar + baz)
122+
@test drop_term(f, term(0)) == f
123+
@test drop_term(f, term(:boz)) == f
123124

124125
form = @formula(foo ~ 1 + bar + baz)
125126
@test form == @formula(foo ~ 1 + bar + baz)

0 commit comments

Comments
 (0)