Skip to content

Commit d34975f

Browse files
authored
Fix warnings in tests (#1960)
1 parent bf4f03e commit d34975f

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

test/namedtuple/productnamedtuple.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ using Test
7373
end
7474

7575
@testset "minimum" begin
76-
nt = (x=Normal(1.0, 2.0), y=Gamma(), z=MvNormal(ones(5)))
76+
nt = (x=Normal(1.0, 2.0), y=Gamma(), z=MvNormal(Diagonal(ones(5))))
7777
d = ProductNamedTupleDistribution(nt)
7878
@test @inferred(minimum(d)) ==
7979
(x=minimum(nt.x), y=minimum(nt.y), z=minimum(nt.z))
8080
end
8181

8282
@testset "maximum" begin
83-
nt = (x=Normal(1.0, 2.0), y=Gamma(), z=MvNormal(ones(5)))
83+
nt = (x=Normal(1.0, 2.0), y=Gamma(), z=MvNormal(Diagonal(ones(5))))
8484
d = ProductNamedTupleDistribution(nt)
8585
@test @inferred(maximum(d)) ==
8686
(x=maximum(nt.x), y=maximum(nt.y), z=maximum(nt.z))
@@ -118,7 +118,7 @@ using Test
118118
end
119119

120120
@testset "Statistics" begin
121-
nt = (x=Normal(1.0, 2.0), y=Gamma(), z=MvNormal(1.0:5.0), w=Poisson(100))
121+
nt = (x=Normal(1.0, 2.0), y=Gamma(), z=MvNormal(Diagonal(abs2.(1.0:5.0))), w=Poisson(100))
122122
d = ProductNamedTupleDistribution(nt)
123123
@test @inferred(mode(d)) == (x=mode(nt.x), y=mode(nt.y), z=mode(nt.z), w=mode(nt.w))
124124
@test @inferred(mean(d)) == (x=mean(nt.x), y=mean(nt.y), z=mean(nt.z), w=mean(nt.w))

test/qq.jl

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
11
using Distributions
22
using Test
33

4-
a = qqbuild(collect(1:10), collect(1:10))
5-
b = qqbuild(1:10, 1:10)
6-
c = qqbuild(view(collect(1:20), 1:10), view(collect(1:20), 1:10))
7-
@test a.qx b.qx c.qx collect(1.0:10)
8-
@test a.qy b.qy c.qy collect(1.0:10)
4+
@testset "qqbuild" begin
5+
a = qqbuild(collect(1:10), collect(1:10))
6+
b = qqbuild(1:10, 1:10)
7+
c = qqbuild(view(collect(1:20), 1:10), view(collect(1:20), 1:10))
8+
@test a.qx b.qx c.qx collect(1.0:10)
9+
@test a.qy b.qy c.qy collect(1.0:10)
910

11+
pp = Distributions.ppoints(10)
12+
@test length(pp) == 10
13+
@test minimum(pp) >= 0
14+
@test maximum(pp) <= 1
1015

11-
pp = Distributions.ppoints(10)
12-
@test length(pp) == 10
13-
@test minimum(pp) >= 0
14-
@test maximum(pp) <= 1
16+
a = qqbuild(collect(1:10), Uniform(1,10))
17+
b = qqbuild(1:10, Uniform(1,10))
18+
c = qqbuild(view(collect(1:20), 1:10), Uniform(1,10))
19+
@test length(a.qy) == length(a.qx) == 10
20+
@test a.qx b.qx c.qx a.qy b.qy c.qy
1521

16-
a = qqbuild(collect(1:10), Uniform(1,10))
17-
b = qqbuild(1:10, Uniform(1,10))
18-
c = qqbuild(view(collect(1:20), 1:10), Uniform(1,10))
19-
@test length(a.qy) == length(a.qx) == 10
20-
@test a.qx b.qx c.qx a.qy b.qy c.qy
22+
a = qqbuild(Uniform(1,10), collect(1:10))
23+
b = qqbuild(Uniform(1,10), 1:10)
24+
c = qqbuild(Uniform(1,10), view(collect(1:20), 1:10))
25+
@test length(a.qy) == length(a.qx) == 10
26+
@test a.qx b.qx c.qx a.qy b.qy c.qy
2127

22-
a = qqbuild(Uniform(1,10), collect(1:10))
23-
b = qqbuild(Uniform(1,10), 1:10)
24-
c = qqbuild(Uniform(1,10), view(collect(1:20), 1:10))
25-
@test length(a.qy) == length(a.qx) == 10
26-
@test a.qx b.qx c.qx a.qy b.qy c.qy
27-
28-
for n in 0:3
29-
a = qqbuild(rand(n), Uniform(0,1))
30-
@test length(a.qy) == length(a.qx) == n
28+
for n in 0:3
29+
a = qqbuild(rand(n), Uniform(0,1))
30+
@test length(a.qy) == length(a.qx) == n
31+
end
3132
end

0 commit comments

Comments
 (0)