From 76e481361bb680926386432b3dd3145d21ad32ab Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 25 Sep 2023 18:32:22 +1300 Subject: [PATCH] add test for display of models --- Project.toml | 2 +- test/runtests.jl | 1 + test/show.jl | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/show.jl diff --git a/Project.toml b/Project.toml index dc7cd027..3d36cc20 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MLJBase" uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d" authors = ["Anthony D. Blaom "] -version = "1.0.0" +version = "0.21 [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" diff --git a/test/runtests.jl b/test/runtests.jl index b805d0dd..0c5593af 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,6 +18,7 @@ include("preliminaries.jl") @conditional_testset "misc" begin @test include("utilities.jl") @test include("static.jl") + @test include("show.jl") end @conditional_testset "interface" begin diff --git a/test/show.jl b/test/show.jl new file mode 100644 index 00000000..a6dc087d --- /dev/null +++ b/test/show.jl @@ -0,0 +1,12 @@ +@testset "display of models" begin + io = IOBuffer() + show(io, KNNRegressor()) + @test String(take!(io)) == "KNNRegressor(K = 5, …)" + show(io, MIME("text/plain"), KNNRegressor()) + @test String(take!(io)) == + "KNNRegressor(\n K = 5, \n algorithm = :kdtree, \n "* + "metric = Distances.Euclidean(0.0), \n leafsize = 10, \n "* + "reorder = true, \n weights = :uniform)" +end + +true