From 11b82022495d86f055178bb4ac16088840a3fe3c Mon Sep 17 00:00:00 2001 From: Diego Javier Zea Date: Wed, 21 Nov 2018 01:09:50 +0100 Subject: [PATCH] Doctests for Julia 0.7/1.0 --- .travis.yml | 4 +- NEWS.md | 3 + REQUIRE | 2 +- appveyor.yml | 1 + docs/make.jl | 2 +- src/PairwiseListMatrices.jl | 16 ++- src/macros.jl | 24 ++-- src/pairwiselistmatrix.jl | 237 +++++++++++++----------------------- test/runtests.jl | 10 +- 9 files changed, 125 insertions(+), 174 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa8a8d9..23a0100 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ os: julia: - 0.7 - 1.0 + - nightly + notifications: email: false @@ -16,4 +18,4 @@ after_success: - julia -e 'using Pkg; using PairwiseListMatrices; cd(dirname(pathof(PairwiseListMatrices))); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' - julia -e 'using Pkg; Pkg.add("Documenter")' - julia -e 'using Pkg; Pkg.add("Plots"); Pkg.add("GR")' # Plots - - julia -e 'cd(dirname(pathof(PairwiseListMatrices))); include(joinpath("docs", "make.jl"))' + - julia -e 'cd(dirname(pathof(PairwiseListMatrices))); include(joinpath("..", "docs", "make.jl"))' diff --git a/NEWS.md b/NEWS.md index a0b5212..2a37dc7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,9 @@ PairwiseListMatrices v0.6 was the last version with Julia 0.6 support. * `writecsv` changed to `writedlm` using `delim=','`. +* A type parameter to indicate the wrapped matrix type was added to +`NamedResidueMatrix`, which is now `NamedResidueMatrix{Array{Residue,2}}`. + ### Changes from v0.5 to v0.6 PairwiseListMatrices v0.6 requires Julia v0.6. diff --git a/REQUIRE b/REQUIRE index f979319..ec39c80 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,3 @@ -julia 0.7 1.0 +julia 0.7 NamedArrays RecipesBase diff --git a/appveyor.yml b/appveyor.yml index 9458b4a..3d86135 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,7 @@ environment: matrix: - julia_version: 0.7 - julia_version: 1.0 + - julia_version: latest platform: - x86 # 32-bit diff --git a/docs/make.jl b/docs/make.jl index f470102..25e5689 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,6 +1,7 @@ using Documenter, PairwiseListMatrices makedocs( + doctest = true, format = :html, sitename = "PairwiseListMatrices", modules = [PairwiseListMatrices], @@ -13,7 +14,6 @@ makedocs( deploydocs( repo = "github.com/diegozea/PairwiseListMatrices.jl.git", target = "build", - julia = "0.6", deps = nothing, make = nothing ) diff --git a/src/PairwiseListMatrices.jl b/src/PairwiseListMatrices.jl index 017373c..1d83b2d 100644 --- a/src/PairwiseListMatrices.jl +++ b/src/PairwiseListMatrices.jl @@ -1,6 +1,12 @@ __precompile__() +""" +This package allows you to use a pairwise list as a symmetric matrix. +```julia +using PairwiseListMatrices +``` +""" module PairwiseListMatrices # standard libraries @@ -28,18 +34,10 @@ export @iterateupper, from_table, to_table, to_dict, join, - to_dataframe, from_dataframe + writedlm include("macros.jl") include("pairwiselistmatrix.jl") include("plotrecipes.jl") -function to_dataframe(args...) - throw(ErrorException("Deprecated function, use DataFrame(to_dict(args...)) instead.")) -end - -function from_dataframe(args...) - throw(ErrorException("Deprecated function, use from_table(args...) instead.")) -end - end diff --git a/src/macros.jl b/src/macros.jl index 57742e7..6c8ff99 100644 --- a/src/macros.jl +++ b/src/macros.jl @@ -6,9 +6,11 @@ In the body `list` will be the list field of the `PairwiseListMatrix` and `k` th over that list. Other variables should be interpolated in a quote. You must not modify the value of `k`. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> PLM = PairwiseListMatrix([1,2,3], false) -3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}: +3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}: 0 1 2 1 0 3 2 3 0 @@ -37,9 +39,11 @@ second is the body of the loop. In the body `diag` will be the diag field of the `PairwiseListMatrix` and `k` the index over that vector. Other variables should be interpolated in a quote. You must not modify the value of `k`. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> PLM = PairwiseListMatrix([1,2,3], false) -3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}: +3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}: 0 1 2 1 0 3 2 3 0 @@ -47,7 +51,7 @@ julia> PLM = PairwiseListMatrix([1,2,3], false) julia> @iteratediag PLM diag[k] += 10k julia> PLM -3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}: +3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}: 10 1 2 1 20 3 2 3 30 @@ -75,9 +79,11 @@ You can also use the respective `i` and `j` indexes for that position `k` in the triangular part of the matrix. Other variables should be interpolated in a quote. You must not modify the values of `i`, `j` or `k`. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> PLM = PairwiseListMatrix([1,2,3], true) -2×2 PairwiseListMatrices.PairwiseListMatrix{Int64,true,Array{Int64,1}}: +2×2 PairwiseListMatrix{Int64,true,Array{Int64,1}}: 1 2 2 3 @@ -86,7 +92,9 @@ julia> mat = zeros(Int, 2, 2) 0 0 0 0 -julia> @iterateupper PLM true :(\$mat)[i,j] = list[k] +julia> let mat = mat # To avoid using global + @iterateupper PLM true :(\$mat)[i,j] = list[k] + end julia> mat 2×2 Array{Int64,2}: diff --git a/src/pairwiselistmatrix.jl b/src/pairwiselistmatrix.jl index 190b2f6..5e97f87 100644 --- a/src/pairwiselistmatrix.jl +++ b/src/pairwiselistmatrix.jl @@ -49,9 +49,11 @@ end Returns the list length needed for a pairwise measures or comparisons of `nelements`. If `diagonal` is `true`, diagonal values are included in the list. -``` +```jldoctest +julia> using PairwiseListMatrices + julia> plm = PairwiseListMatrix([1, 2, 3, 4, 5, 6], false) -4×4 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}: +4×4 PairwiseListMatrix{Int64,false,Array{Int64,1}}: 0 1 2 3 1 0 4 5 2 4 0 6 @@ -81,9 +83,11 @@ Returns the `k` index of the `list` from the indixes `i` and `j` with `ij`. -``` +```jldoctest +julia> using PairwiseListMatrices + julia> plm = PairwiseListMatrix([10,20,30,40,50,60], true) -3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,true,Array{Int64,1}}: +3×3 PairwiseListMatrix{Int64,true,Array{Int64,1}}: 10 20 30 20 40 50 30 50 60 @@ -107,7 +111,9 @@ function _diagonal_value(diagonal::Bool, ::Type{T}) where T if !diagonal if hasmethod(zero, (T,)) return zero(T) - elseif T == Any + elseif T <: Union{Missing, Int} + return missing + elseif T === Any return nothing else throw(ErrorException( @@ -430,9 +436,11 @@ end Returns a vector of type `VT` from a `PairwiseListMatrix{T, false, VT}` that has the diagonal values. -``` +```jldoctest +julia> using PairwiseListMatrices + julia> plm = PairwiseListMatrix([10,20,30,40,50,60], true) -3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,true,Array{Int64,1}}: +3×3 PairwiseListMatrix{Int64,true,Array{Int64,1}}: 10 20 30 20 40 50 30 50 60 @@ -515,30 +523,6 @@ function Base.Broadcast.broadcasted(::Broadcast.DefaultArrayStyle{2}, PairwiseListMatrix{E, D, typeof(list)}(list, diag, plm.nelements) end -# struct PLMStyle <: Broadcast.BroadcastStyle end -# -# Base.BroadcastStyle(::Type{PairwiseListMatrix{T, D, VT}}) where {T, D, VT} = PLMStyle() -# -# function Base.similar(bc::Broadcast.Broadcasted{PLMStyle}, -# ::Type{E}) where E -# A = _find_plm(bc) -# similar(A, E) -# end -# -# "`A = _find_plm(As)` returns the first PairwiseListMatrix among the arguments." -# _find_plm(bc::Base.Broadcast.Broadcasted) = _find_plm(bc.args) -# _find_plm(args::Tuple) = _find_plm(_find_plm(args[1]), Base.tail(args)) -# _find_plm(x) = x -# _find_plm(a::PairwiseListMatrix, rest) = a -# _find_plm(::Any, rest) = _find_plm(rest) -# -# Base.BroadcastStyle(::PLMStyle, ::Base.Broadcast.DefaultArrayStyle{0}) = PLMStyle() -# Base.BroadcastStyle(::Base.Broadcast.DefaultArrayStyle{0}, ::PLMStyle) = PLMStyle() -# -# Base.BroadcastStyle(::PLMStyle, ::T) where T <: Base.Broadcast.BroadcastStyle = T() -# Base.BroadcastStyle(::T, ::PLMStyle) where T <: Base.Broadcast.BroadcastStyle = T() -# - @inline function Base.copyto!(dest::PairwiseListMatrix{T, D, VT}, bc::Base.Broadcast.Broadcasted{Nothing}) where {T, D, VT} axes(dest) == axes(bc) || Base.Broadcast.throwdm(axes(dest), axes(bc)) @@ -610,63 +594,6 @@ function LinearAlgebra.svd(m::LowerTriangular{T,PairwiseListMatrix{T,D,VT}}) whe svd(Matrix(m)) end -# Binary operations (faster than default methods) -# =============================================== - -# for F in (:broadcast, :broadcast!) -# @eval begin -# function Base.$F(f, -# A::PairwiseListMatrix{T,true,VT}, -# B::PairwiseListMatrix{S,true,VS}) where {T,S,VT,VS} -# @assert A.nelements == B.nelements "Matrices must have the same number of elements" -# list = $F(f, A.list, B.list) -# VOUT = typeof(list) -# diag = convert(VOUT, T[]) -# PairwiseListMatrix{eltype(list), true, VOUT}(list, diag, copy(A.nelements)) -# end -# -# function Base.$F(f, -# A::PairwiseListMatrix{T,false,VT}, -# B::PairwiseListMatrix{S,false,VS}) where {T,S,VT,VS} -# @assert A.nelements == B.nelements "Matrices must have the same number of elements" -# list = $F(f, A.list, B.list) -# VOUT = typeof(list) -# diag = convert(VOUT, $F(f, A.diag, B.diag)) -# PairwiseListMatrix{eltype(list), false, VOUT}(list, diag, copy(A.nelements)) -# end -# -# function Base.$F(f, A::PairwiseListMatrix{T,true,VT}, B::Number) where {T,VT} -# list = $F(f, A.list, B) -# VOUT = typeof(list) -# diag = convert(VOUT, T[]) -# PairwiseListMatrix{eltype(list), true, VOUT}(list, diag, copy(A.nelements)) -# end -# -# function Base.$F(f, A::PairwiseListMatrix{T, false, VT}, B::Number) where {T,VT} -# list = $F(f, A.list, B) -# VOUT = typeof(list) -# diag = convert(VOUT, $F(f, A.diag, B)) -# PairwiseListMatrix{eltype(list), false, VOUT}(list, diag, copy(A.nelements)) -# end -# -# # Several functions are not commutative: i.e. ./ -# -# function Base.$F(f, A::Number, B::PairwiseListMatrix{T,true,VT}) where {T,VT} -# list = $F(f, A, B.list) -# VOUT = typeof(list) -# diag = convert(VOUT, T[]) -# PairwiseListMatrix{eltype(list), true, VOUT}(list, diag, copy(B.nelements)) -# end -# -# function Base.$F(f, A::Number, B::PairwiseListMatrix{T, false, VT}) where {T,VT} -# list = $F(f, A, B.list) -# VOUT = typeof(list) -# diag = convert(VOUT, $F(f, A, B.diag)) -# PairwiseListMatrix{eltype(list), false, VOUT}(list, diag, copy(B.nelements)) -# end -# end -# end - # Faster mean and sum # =================== @@ -777,12 +704,12 @@ function _sum_nodiag_kernel!(sum_i, lm::PairwiseListMatrix{T,false,VT}, N) where sum_i end -"Sum the values outside the diagonal" _sum_nodiag(m::PairwiseListMatrix{T,false,VT}) where {T,VT} = T(2) * sum(m.list) function _sum_nodiag(m::PairwiseListMatrix{T,true,VT}) where {T,VT} T(2) * sum(m.list) - sum(diagonal(m)) end +"Sum the values outside the diagonal" function sum_nodiag(lm::PairwiseListMatrix{T,diagonal,VT}; dims::Union{Int,Colon}=:) where {T,diagonal,VT} if isa(dims, Colon) @@ -971,9 +898,11 @@ zscore(list, mat) = zscore!(list, copy(mat)) """ It gets the labels of a PairwiseListMatrix. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> plm = PairwiseListMatrix(ones(3), false) -3×3 PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}}: +3×3 PairwiseListMatrix{Float64,false,Array{Float64,1}}: 0.0 1.0 1.0 1.0 0.0 1.0 1.0 1.0 0.0 @@ -985,7 +914,7 @@ julia> getlabels(plm) "3" julia> nplm = setlabels(plm, ["a","b","c"]) -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +3×3 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ a b c ──────┼────────────── a │ 0.0 1.0 1.0 @@ -1020,15 +949,17 @@ end """ Creates a Named PairwiseListMatrix. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> plm = PairwiseListMatrix(ones(3), false) -3×3 PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}}: +3×3 PairwiseListMatrix{Float64,false,Array{Float64,1}}: 0.0 1.0 1.0 1.0 0.0 1.0 1.0 1.0 0.0 julia> nplm = setlabels(plm, ["a","b","c"]) -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +3×3 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ a b c ──────┼────────────── a │ 0.0 1.0 1.0 @@ -1075,9 +1006,11 @@ end Creates a `Matrix{Any}`, labels are stored in the columns 1 and 2, and the values in the column 3. Diagonal values are included by default. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> plm = PairwiseListMatrix([10,20,30], false) -3×3 PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}}: +3×3 PairwiseListMatrix{Int64,false,Array{Int64,1}}: 0 10 20 10 0 30 20 30 0 @@ -1123,9 +1056,11 @@ end It takes a `PairwiseListMatrix` and converts it to a `Dict` of `Symbol`s to arrays. The returned dictionary can be easily converted into a `DataFrame`. -```julia +```jldoctest +julia> using PairwiseListMatrices, DataFrames + julia> nplm = setlabels(PairwiseListMatrix([10,20,30], false), ["a","b","c"]) -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Int64,false,Array{Int64,1}} +3×3 Named PairwiseListMatrix{Int64,false,Array{Int64,1}} A ╲ B │ a b c ──────┼─────────── a │ 0 10 20 @@ -1133,21 +1068,19 @@ b │ 10 0 30 c │ 20 30 0 julia> dict = to_dict(nplm, diagonal=false) -Dict{Symbol,Any} with 3 entries: - :i => String["a","a","b"] - :values => [10,20,30] - :j => String["b","c","c"] - -julia> using DataFrames +Dict{Symbol,Array{T,1} where T} with 3 entries: + :values => [10, 20, 30] + :j => ["b", "c", "c"] + :i => ["a", "a", "b"] julia> DataFrame(dict) 3×3 DataFrames.DataFrame -│ Row │ i │ j │ values │ -├─────┼─────┼─────┼────────┤ -│ 1 │ "a" │ "b" │ 10 │ -│ 2 │ "a" │ "c" │ 20 │ -│ 3 │ "b" │ "c" │ 30 │ - +│ Row │ i │ j │ values │ +│ │ String │ String │ Int64 │ +├─────┼────────┼────────┼────────┤ +│ 1 │ a │ b │ 10 │ +│ 2 │ a │ c │ 20 │ +│ 3 │ b │ c │ 30 │ ``` """ function to_dict(plm::PairwiseListMatrix{T,D,TV}; @@ -1179,17 +1112,21 @@ Creation of a `PairwiseListMatrix` from a `Matrix`, `DataFrame` or similar struc By default the columns with the labels for i (slow) and j (fast) are 1 and 2. Values are taken from the column 3 by default. -```julia -julia> filename = joinpath(Pkg.dir("PairwiseListMatrices"),"test","example.csv"); +```jldoctest +julia> using PairwiseListMatrices, Pkg, DelimitedFiles + +julia> import PairwiseListMatrices -julia> dat = readdlm(filename) +julia> filename = joinpath(dirname(pathof(PairwiseListMatrices)), "..", "test", "example.csv"); + +julia> dat = readdlm(filename, ',') 3×3 Array{Any,2}: "A" "B" 10 "A" "C" 20 "B" "C" 30 julia> from_table(dat, false) -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Any,false,Array{Any,1}} +3×3 Named PairwiseListMatrix{Any,false,Array{Any,1}} A ╲ B │ A B C ──────┼────────────────────────── A │ nothing 10 20 @@ -1199,26 +1136,29 @@ C │ 20 30 nothing This is also useful to create a `PairwiseListMatrix` from a `DataFrame`: -```julia -julia> using DataFrames +``` +julia> using PairwiseListMatrices, DataFrames, CSV, Pkg + +julia> import PairwiseListMatrices -julia> filename = joinpath(Pkg.dir("PairwiseListMatrices"),"test","example.csv"); +julia> filename = joinpath(dirname(pathof(PairwiseListMatrices)), "..", "test", "example.csv"); -julia> df = readtable(filename, header=false) +julia> df = CSV.read(filename, header=false) 3×3 DataFrames.DataFrame -│ Row │ x1 │ x2 │ x3 │ -├─────┼─────┼─────┼────┤ -│ 1 │ "A" │ "B" │ 10 │ -│ 2 │ "A" │ "C" │ 20 │ -│ 3 │ "B" │ "C" │ 30 │ +│ Row │ Column1 │ Column2 │ Column3 │ +│ │ String⍰ │ String⍰ │ Int64⍰ │ +├─────┼─────────┼─────────┼─────────┤ +│ 1 │ A │ B │ 10 │ +│ 2 │ A │ C │ 20 │ +│ 3 │ B │ C │ 30 │ julia> from_table(df, false) -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Int64,false,DataArrays.DataArray{Int64,1}} -A ╲ B │ A B C -──────┼─────────── -A │ 0 10 20 -B │ 10 0 30 -C │ 20 30 0 +3×3 Named PairwiseListMatrix{Union{Missing, Int64},false,Array{Union{Missing, Int64},1}} +A ╲ B │ A B C +──────┼────────────────────────── +A │ missing 10 20 +B │ 10 missing 30 +C │ 20 30 missing ``` """ function from_table(table, @@ -1227,14 +1167,15 @@ function from_table(table, valuecol::Int = 3, diagonalvalue = :default) @assert size(table,2) >= 3 + values = table[:,valuecol] if diagonalvalue == :default - diagonalvalue = _diagonal_value(diagonal, eltype(table[:,valuecol])) + diagonalvalue = _diagonal_value(diagonal, eltype(values)) end - values = table[:,valuecol] plm = PairwiseListMatrix(values, diagonal, diagonalvalue) nplm = NamedArray(plm) if length(labelcols) == 2 - unique_labels = unique(vcat(table[:,labelcols[1]],table[:,labelcols[2]])) + unique_labels = unique(vcat(table[:, labelcols[1]], + table[:, labelcols[2]])) setlabels!(nplm, String[ string(lab) for lab in unique_labels ]) end nplm @@ -1249,16 +1190,18 @@ argument. If the `diagonal` keyword argument is `true` (default), the diagonal i in the output. The keyword argument `delim` (by default is `'\t'`) allows to modified the character used as delimiter. -```julia +```jldoctest +julia> using PairwiseListMatrices, DelimitedFiles + julia> plm = PairwiseListMatrix(trues(3), false) -3×3 PairwiseListMatrices.PairwiseListMatrix{Bool,false,BitArray{1}}: +3×3 PairwiseListMatrix{Bool,false,BitArray{1}}: false true true true false true true true false julia> writedlm("example.csv", plm, diagonal=false, delim=',') -shell> cat example.csv +julia> println(read("example.csv", String)) 1,2,true 1,3,true 2,3,true @@ -1308,9 +1251,11 @@ PairwiseListMatrices with same size and labels. There are 4 `kind`s of joins: `NaN`s are filled in where needed to complete joins. The default value for missing values can be changed passing a tuple to `missing`. -```julia +```jldoctest +julia> using PairwiseListMatrices + julia> l = setlabels(PairwiseListMatrix([1.,2.,3.], false), ["a","b","c"]) # a b c -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +3×3 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ a b c ──────┼────────────── a │ 0.0 1.0 2.0 @@ -1318,7 +1263,7 @@ b │ 1.0 0.0 3.0 c │ 2.0 3.0 0.0 julia> r = setlabels(PairwiseListMatrix([1.,2.,3.], false), ["b","c","d"]) # b c d -3×3 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +3×3 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ b c d ──────┼────────────── b │ 0.0 1.0 2.0 @@ -1326,30 +1271,24 @@ c │ 1.0 0.0 3.0 d │ 2.0 3.0 0.0 julia> join(l, r, kind=:inner) # b c -( -2×2 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +(2×2 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ b c ──────┼───────── b │ 0.0 3.0 -c │ 3.0 0.0, - -2×2 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +c │ 3.0 0.0, 2×2 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ b c ──────┼───────── b │ 0.0 1.0 c │ 1.0 0.0) julia> join(l, r, kind=:outer) # a b c d -( -4×4 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +(4×4 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ a b c d ──────┼─────────────────── a │ 0.0 1.0 2.0 NaN b │ 1.0 0.0 3.0 NaN c │ 2.0 3.0 0.0 NaN -d │ NaN NaN NaN NaN, - -4×4 Named PairwiseListMatrices.PairwiseListMatrix{Float64,false,Array{Float64,1}} +d │ NaN NaN NaN NaN, 4×4 Named PairwiseListMatrix{Float64,false,Array{Float64,1}} A ╲ B │ a b c d ──────┼─────────────────── a │ NaN NaN NaN NaN diff --git a/test/runtests.jl b/test/runtests.jl index 8331b91..b31d45d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -504,7 +504,7 @@ end PLM = PairwiseListMatrix([1,2,3], false) - @iteratelist PLM Test.@test list[k] == k + @iteratelist PLM Main.@test(list[k] == k) list_values = [1,2,3,4,5,6] PLMtrue = PairwiseListMatrix(list_values, true) @@ -512,11 +512,11 @@ end full_t = Matrix(PLMtrue) full_f = Matrix(PLMfalse) - @iteratelist PLMtrue Test.@test list[k] == :($list_values)[k] - @iteratelist PLMfalse Test.@test list[k] == :($list_values)[k] + @iteratelist PLMtrue Main.@test(list[k] == :($list_values)[k]) + @iteratelist PLMfalse Main.@test(list[k] == :($list_values)[k]) - @iteratediag PLMtrue Test.@test false - @iteratediag PLMfalse Test.@test diag[k] == 0 + @iteratediag PLMtrue Main.@test(false) + @iteratediag PLMfalse Main.@test(diag[k] == 0) @iterateupper PLMtrue true list[k] = :($list_values)[k] @iterateupper PLMfalse false list[k] = :($list_values)[k]