Skip to content

Commit 164388e

Browse files
add tests
1 parent 7a3ca55 commit 164388e

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

test/data.jl

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,52 @@
7575
Flux.train!(loss, [θ], ncycle(d, 10), Descent(0.1))
7676
@test norm.- 1) < 1e-10
7777
end
78+
79+
80+
@testset "CMUDict" begin
81+
@test cmudict()["CATASTROPHE"] == :[K,AH0,T,AE1,S,T,R,AH0,F,IY0].args
82+
83+
@test length(CMUDict.phones()) == 39
84+
85+
@test length(CMUDict.symbols()) == 84
86+
end
87+
88+
@testset "MNIST" begin
89+
@test MNIST.images()[1] isa Matrix
90+
@test MNIST.labels() isa Vector{Int64}
91+
end
92+
93+
@testset "FashionMNIST" begin
94+
@test FashionMNIST.images()[1] isa Matrix
95+
@test FashionMNIST.labels() isa Vector{Int64}
96+
end
97+
98+
@testset "Sentiment" begin
99+
@test Data.Sentiment.train() isa Vector{Data.Tree{Any}}
100+
end
101+
102+
@testset "Iris" begin
103+
@test Iris.features() isa Matrix
104+
@test size(Iris.features()) == (4,150)
105+
106+
@test Iris.labels() isa Vector{String}
107+
@test size(Iris.labels()) == (150,)
108+
end
109+
110+
111+
@testset "Housing" begin
112+
@test Housing.features() isa Matrix # test broken due to SSL certifate expiration problem
113+
@test size(Housing.features()) == (506, 13)
114+
115+
@test Housing.targets() isa Array{Float64}
116+
@test size(Housing.targets()) == (506, 1)
117+
end
118+
119+
@testset "Tree show" begin
120+
# testcase for issue #1354
121+
# testing that methods(Base.show) does not throw. Having something more specific would be too fragile
122+
buf = IOBuffer()
123+
Base.show(buf, filter(x->x.module == Flux, methods(Base.show).ms))
124+
str_repr = String(take!(buf))
125+
@test !isempty(str_repr)
126+
end

0 commit comments

Comments
 (0)