display and printinghelp wantedtestsystem
Repository metrics
- Stars
- (48,709 stars)
- PR merge metrics
- (Avg merge 20d 6h) (157 merged PRs in 30d)
Description
When @test x isa Thing fails it can show output that looks like it should have passed, because it does not print the type of x.
Here's an example [using Julia 1.1.0]:
julia> using Distributions, LinearAlgebra, Test
julia> covt(x) = cov(x)' # means we will get an `Adjoint`
covt (generic function with 1 method)
julia> z = MvNormal(2, 1);
julia> @test covt(z) isa Matrix
Test Failed at REPL[12]:1
Expression: covt(z) isa Matrix
Evaluated: [1.0 0.0; 0.0 1.0] isa Array{T,2} where T
ERROR: There was an error during testing
This is confusing because if you copy and paste the "Evaluated: ..." code in to a test it will pass
julia> @test [1.0 0.0; 0.0 1.0] isa Array{T,2} where T
Test Passed
It may be more informative if the output of the failed test was more like
julia> @test covt(z) isa Matrix
Test Failed at REPL[12]:1
Expression: covt(z) isa Matrix
Evaluated: Adjoint{Float64,Array{Float64,2}} <: Array{T,2} where T
ERROR: There was an error during testing
(where Evaluiated: could show <: rather than isa, since (Array{Float64,2} isa Array{T,2} where T) == false).