Skip to content

Commit

Permalink
Fix most depwarn/error on 0.6 (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao authored and andreasnoack committed Feb 10, 2017
1 parent addbe72 commit f807e01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ type Histogram{T<:Real,N,E} <: AbstractHistogram{T,N,E}
edges::E
weights::Array{T,N}
closed::Symbol
function Histogram(edges::NTuple{N,AbstractArray},weights::Array{T,N},closed::Symbol)
function (::Type{Histogram{T,N,E}}){T,N,E}(edges::NTuple{N,AbstractArray},
weights::Array{T,N}, closed::Symbol)
closed == :right || closed == :left || error("closed must :left or :right")
map(x -> length(x)-1,edges) == size(weights) || error("Histogram edge vectors must be 1 longer than corresponding weight dimensions")
new(edges,weights,closed)
new{T,N,E}(edges,weights,closed)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ l,h = extrema(StatsBase.histrange([typemin(Int),typemax(Int)], 10))
# hist show
show_h = sprint(show, fit(Histogram,[1,2,3]))
@test contains(show_h, "edges:\n 0.0:1.0:3.0")
@test contains(show_h, string("weights: ", [1,1,1]))
@test contains(show_h, "weights: $([1,1,1])")
@test contains(show_h, "closed: right")

0 comments on commit f807e01

Please sign in to comment.