Skip to content

Commit 56c2b17

Browse files
committed
Add JET tests
1 parent 3efb801 commit 56c2b17

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
2121
AliasTables = "1"
2222
DataAPI = "1"
2323
DataStructures = "0.10, 0.11, 0.12, 0.13, 0.14, 0.17, 0.18"
24+
JET = "0.9.19"
2425
LinearAlgebra = "<0.0.1, 1"
2526
LogExpFunctions = "0.3"
2627
Missings = "0.3, 0.4, 1.0"
@@ -35,9 +36,10 @@ julia = "1.10"
3536
[extras]
3637
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
3738
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
39+
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
3840
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
3941
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
4042
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4143

4244
[targets]
43-
test = ["Dates", "DelimitedFiles", "OffsetArrays", "StableRNGs", "Test"]
45+
test = ["Dates", "DelimitedFiles", "JET", "OffsetArrays", "StableRNGs", "Test"]

src/cov.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ end
2323

2424
## scatter matrix
2525

26-
_unscaled_covzm(x::DenseMatrix, dims::Colon) = unscaled_covzm(x)
2726
_unscaled_covzm(x::DenseMatrix, dims::Integer) = unscaled_covzm(x, dims)
28-
29-
_unscaled_covzm(x::DenseMatrix, wv::AbstractWeights, dims::Colon) =
30-
_symmetrize!(unscaled_covzm(x, _scalevars(x, wv)))
3127
_unscaled_covzm(x::DenseMatrix, wv::AbstractWeights, dims::Integer) =
3228
_symmetrize!(unscaled_covzm(x, _scalevars(x, wv, dims), dims))
3329

src/deprecates.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if !isdefined(Base, :stderr)
55
else
66
function (io::typeof(stderr))(obj::StatisticalModel)
77
Base.depwarn("stderr(obj::StatisticalModel) is deprecated, use stderror(obj) instead", :stderr)
8-
io === stderr ? stderror(obj) : throw(MethodErrror(io, (obj,)))
8+
io === stderr ? stderror(obj) : throw(MethodError(io, (obj,)))
99
end
1010
end
1111

@@ -22,8 +22,6 @@ end
2222
@deprecate scattermatm(x::DenseMatrix, mean, wv::AbstractWeights, dims::Int) scattermat(x, wv, mean=mean, dims=dims)
2323
@deprecate scattermat(x::DenseMatrix, dims::Int) scattermat(x, dims=dims)
2424
@deprecate scattermat(x::DenseMatrix, wv::AbstractWeights, dims::Int) scattermat(x, wv, dims=dims)
25-
@deprecate scattermat_zm(x::DenseMatrix, dims::Int) scattermat_zm(x, dims=dims)
26-
@deprecate scattermat_zm(x::DenseMatrix, wv::AbstractWeights, dims::Int) scattermat_zm(x::DenseMatrix, wv::AbstractWeights, dims=dims)
2725
@deprecate mean!(R::AbstractArray, A::AbstractArray, w::AbstractWeights, dims::Int) mean!(R, A, w, dims=dims)
2826
@deprecate mean(A::AbstractArray{T}, w::AbstractWeights{W}, dims::Int) where {T<:Number,W<:Real} mean(A, w, dims=dims)
2927

src/weights.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ function _wsum1!(R::AbstractArray, A::AbstractVector, w::AbstractVector, init::B
464464
end
465465

466466
function _wsum2_blas!(R::StridedVector{T}, A::StridedMatrix{T}, w::StridedVector{T}, dim::Int, init::Bool) where T<:BlasReal
467-
beta = ifelse(init, zero(T), one(T))
467+
beta = ifelse(init, false, true)
468468
trans = dim == 1 ? 'T' : 'N'
469-
BLAS.gemv!(trans, one(T), A, w, beta, R)
469+
BLAS.gemv!(trans, true, A, w, beta, R)
470470
return R
471471
end
472472

test/jet.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using StatsBase, JET, Test
2+
3+
@testset "JET" begin
4+
JET.test_package(StatsBase; target_modules = [StatsBase])
5+
# JET errors on interface definitions: https://github.com/aviatesk/JET.jl/issues/495
6+
# The (deprecated) `model_response(::StatisticalModel)` calls the interface
7+
# function `response(::StatisticalModel)` for which no method exists yet
8+
res = JET.report_package(StatsBase; target_defined_modules = true, toplevel_logger = nothing)
9+
@test length(JET.get_reports(res)) == 1
10+
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using LinearAlgebra
44
using Random
55

66
tests = ["ambiguous",
7+
"jet",
78
"weights",
89
"moments",
910
"scalarstats",

0 commit comments

Comments
 (0)