Skip to content

Commit 40f490f

Browse files
fix print test (#173)
1 parent 47b1e40 commit 40f490f

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

Diff for: test/dataloader.jl

+21-19
Original file line numberDiff line numberDiff line change
@@ -215,24 +215,26 @@
215215
@test copy(Map(x -> x[1]), Vector{Int}, dloader) != collect(1:2:1000)
216216
end
217217

218-
@testset "printing" begin
219-
X2 = reshape(Float32[1:10;], (2, 5))
220-
Y2 = [1:5;]
221-
222-
d = DataLoader((X2, Y2), batchsize=3)
223-
224-
@test contains(repr(d), "DataLoader(::Tuple{Matrix")
225-
@test contains(repr(d), "batchsize=3")
226-
227-
@test contains(repr(MIME"text/plain"(), d), "2-element DataLoader")
228-
@test contains(repr(MIME"text/plain"(), d), "2×3 Matrix{Float32}, 3-element Vector")
229-
230-
d2 = DataLoader((x = X2, y = Y2), batchsize=2, partial=false)
231-
232-
@test contains(repr(d2), "DataLoader(::NamedTuple")
233-
@test contains(repr(d2), "partial=false")
234-
235-
@test contains(repr(MIME"text/plain"(), d2), "2-element DataLoader(::NamedTuple")
236-
@test contains(repr(MIME"text/plain"(), d2), "x = 2×2 Matrix{Float32}, y = 2-element Vector")
218+
if VERSION > v"1.10"
219+
@testset "printing" begin
220+
X2 = reshape(Float32[1:10;], (2, 5))
221+
Y2 = [1:5;]
222+
223+
d = DataLoader((X2, Y2), batchsize=3)
224+
225+
@test contains(repr(d), "DataLoader(::Tuple{Matrix")
226+
@test contains(repr(d), "batchsize=3")
227+
228+
@test contains(repr(MIME"text/plain"(), d), "2-element DataLoader")
229+
@test contains(repr(MIME"text/plain"(), d), "2×3 Matrix{Float32}, 3-element Vector")
230+
231+
d2 = DataLoader((x = X2, y = Y2), batchsize=2, partial=false)
232+
233+
@test contains(repr(d2), "DataLoader(::@NamedTuple")
234+
@test contains(repr(d2), "partial=false")
235+
236+
@test contains(repr(MIME"text/plain"(), d2), "2-element DataLoader(::@NamedTuple")
237+
@test contains(repr(MIME"text/plain"(), d2), "x = 2×2 Matrix{Float32}, y = 2-element Vector")
238+
end
237239
end
238240
end

0 commit comments

Comments
 (0)