Skip to content

Commit

Permalink
remove all dprecation warnings from base / tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebolewski committed Oct 6, 2014
1 parent c562ef9 commit c4b81f4
Show file tree
Hide file tree
Showing 15 changed files with 214 additions and 66 deletions.
2 changes: 1 addition & 1 deletion base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ function keymap{D<:Dict}(keymaps::Array{D})
end

const escape_defaults = merge!(
{char(i) => nothing for i=[1:26, 28:31]}, # Ignore control characters by default
{char(i) => nothing for i=vcat(1:26, 28:31)}, # Ignore control characters by default
{ # And ignore other escape sequences by default
"\e*" => nothing,
"\e[*" => nothing,
Expand Down
4 changes: 2 additions & 2 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ typealias AbstractVecOrMat{T} Union(AbstractVector{T}, AbstractMatrix{T})

## Basic functions ##

vect() = Array(None, 0)
vect() = Array(Void, 0)
vect{T}(X::T...) = T[ X[i] for i=1:length(X) ]

const _oldstyle_array_vcat_ = true
Expand All @@ -23,7 +23,7 @@ if _oldstyle_array_vcat_
before = "a,b,..."
after = "a;b;..."
end
warn_once("[$before] concatenation is deprecated; use [$after] instead")
warn("[$before] concatenation is deprecated; use [$after] instead")
end
function vect(A::AbstractArray...)
oldstyle_vcat_warning(length(A))
Expand Down
4 changes: 2 additions & 2 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ getindex(T::(Type...)) = Array(T,0)
if _oldstyle_array_vcat_
# T[a:b] and T[a:s:b] also contruct typed ranges
function getindex{T<:Number}(::Type{T}, r::Range)
warn_once("T[a:b] concatenation is deprecated; use T[a:b;] instead")
warn("T[a:b] concatenation is deprecated; use T[a:b;] instead")
copy!(Array(T,length(r)), r)
end

function getindex{T<:Number}(::Type{T}, r1::Range, rs::Range...)
warn_once("T[a:b,...] concatenation is deprecated; use T[a:b;...] instead")
warn("T[a:b,...] concatenation is deprecated; use T[a:b;...] instead")
a = Array(T,length(r1)+sum(length,rs))
o = 1
copy!(a, o, r1)
Expand Down
8 changes: 4 additions & 4 deletions base/dates/periods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Base.isless(x::Period,y::Period) = throw(ArgumentError("Can't compare $(typeof(x

#Period Arithmetic:
import Base.div, Base.mod, Base.gcd, Base.lcm
let vec_ops = [:.+,:.-,:.*,:.%,:div]
for op in [:+,:-,:*,:%,:mod,:gcd,:lcm,vec_ops]
let vec_ops = Symbol[:.+, :.-, :.*, :.%, :div]
for op in [:+; :-; :*; :%; :mod; :gcd; :lcm; vec_ops]
@eval begin
#Period-Period
($op){P<:Period}(x::P,y::P) = P(($op)(value(x),value(y)))
Expand Down Expand Up @@ -101,7 +101,7 @@ function Base.string(x::CompoundPeriod)
for p in x.periods
s *= ", " * string(p)
end
return s[3:end]
return s[3:end;]
end
Base.show(io::IO,x::CompoundPeriod) = print(io,string(x))
# E.g. Year(1) + Day(1)
Expand Down Expand Up @@ -148,4 +148,4 @@ days(c::Week) = 7*value(c)
days(c::Year) = 365.2425*value(c)
days(c::Month) = 30.436875*value(c)

Day{T<:FixedPeriod}(c::T) = Day(days(c))
Day{T<:FixedPeriod}(c::T) = Day(days(c))
2 changes: 1 addition & 1 deletion test/bigint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ee = typemax(Int64)
@test string(d) == "-246913578024691357802469135780"
@test string(a) == "123456789012345678901234567890"

for i = -10:10, j = [-10:-1;1:10]
for i = -10:10, j = [-10:-1; 1:10]
@test div(BigInt(i), BigInt(j)) == div(i,j)
@test fld(BigInt(i), BigInt(j)) == fld(i,j)
@test mod(BigInt(i), BigInt(j)) == mod(i,j)
Expand Down
2 changes: 1 addition & 1 deletion test/dates/accessors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ dr = [a,a,a,a,a,a,a,a,a,a]
@test Dates.hour(dr) == repmat([0],10)
@test Dates.minute(dr) == repmat([0],10)
@test Dates.second(dr) == repmat([0],10)
@test Dates.millisecond(dr) == repmat([0],10)
@test Dates.millisecond(dr) == repmat([0],10)
2 changes: 1 addition & 1 deletion test/dates/adjusters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,4 @@ end) == 251
dt += Dates.Day(1)
end
return sum == 15
end) == 15 # On average, there's one of those months every year
end) == 15 # On average, there's one of those months every year
2 changes: 1 addition & 1 deletion test/dates/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@ dt2 = dt + Dates.Year(1)
@test Dates.hour(dt2) == 12
@test Dates.minute(dt2) == 30
@test Dates.second(dt2) == 45
@test Dates.millisecond(dt2) == 500
@test Dates.millisecond(dt2) == 500
2 changes: 1 addition & 1 deletion test/dates/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@

@test typeof(Dates.now()) <: Dates.DateTime
@test typeof(Dates.today()) <: Dates.Date
@test typeof(Dates.now(Dates.UTC)) <: Dates.DateTime
@test typeof(Dates.now(Dates.UTC)) <: Dates.DateTime
2 changes: 1 addition & 1 deletion test/dates/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ f = "y m d"
# Vectorized
dr = ["2000-01-01","2000-01-02","2000-01-03","2000-01-04","2000-01-05"
,"2000-01-06","2000-01-07","2000-01-08","2000-01-09","2000-01-10"]
dr2 = [Dates.Date(2000):Dates.Date(2000,1,10)]
dr2 = [Dates.Date(2000):Dates.Date(2000,1,10);]
@test Dates.Date(dr) == dr2
@test Dates.Date(dr,"yyyy-mm-dd") == dr2
@test Dates.DateTime(dr) == Dates.DateTime(dr2)
Expand Down
44 changes: 22 additions & 22 deletions test/dates/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function test_all_combos()
@test_throws ErrorException maximum(dr)
@test_throws BoundsError dr[1]
@test findin(dr,dr) == Int64[]
@test [dr] == T[]
@test [dr;] == T[]
@test isempty(reverse(dr))
@test length(reverse(dr)) == 0
@test first(reverse(dr)) == f1-one(l1 - f1)
Expand Down Expand Up @@ -47,8 +47,8 @@ function test_all_combos()
if len < 10000
dr1 = [i for i in dr]
@test length(dr1) == len
@test findin(dr,dr) == [1:len]
@test length([dr]) == len
@test findin(dr,dr) == [1:len;]
@test length([dr;]) == len
end
@test !isempty(reverse(dr))
@test length(reverse(dr)) == len
Expand All @@ -70,7 +70,7 @@ function test_all_combos()
@test_throws ErrorException maximum(dr)
@test_throws BoundsError dr[1]
@test findin(dr,dr) == Int64[]
@test [dr] == T[]
@test [dr;] == T[]
@test isempty(reverse(dr))
@test length(reverse(dr)) == 0
@test first(reverse(dr)) == l1+one(l1 - f1)
Expand Down Expand Up @@ -99,8 +99,8 @@ function test_all_combos()
if len < 10000
dr1 = [i for i in dr]
@test length(dr1) == len
@test findin(dr,dr) == [1:len]
@test length([dr]) == len
@test findin(dr,dr) == [1:len;]
@test length([dr;]) == len
end
@test !isempty(reverse(dr))
@test length(reverse(dr)) == len
Expand All @@ -123,7 +123,7 @@ function test_all_combos()
@test_throws ErrorException maximum(dr)
@test_throws BoundsError dr[1]
@test findin(dr,dr) == Int64[]
@test [dr] == T[]
@test [dr;] == T[]
@test isempty(reverse(dr))
@test length(reverse(dr)) == 0
@test first(reverse(dr)) == f1-one(l1 - f1)
Expand Down Expand Up @@ -152,8 +152,8 @@ function test_all_combos()
if len < 10000
dr1 = [i for i in dr]
@test length(dr1) == len
@test findin(dr,dr) == [1:len]
@test length([dr]) == len
@test findin(dr,dr) == [1:len;]
@test length([dr;]) == len
end
@test !isempty(reverse(dr))
@test length(reverse(dr)) == len
Expand All @@ -175,7 +175,7 @@ function test_all_combos()
@test_throws ErrorException maximum(dr)
@test_throws BoundsError dr[1]
@test findin(dr,dr) == Int64[]
@test [dr] == T[]
@test [dr;] == T[]
@test isempty(reverse(dr))
@test length(reverse(dr)) == 0
@test first(reverse(dr)) == l1+one(l1 - f1)
Expand Down Expand Up @@ -204,8 +204,8 @@ function test_all_combos()
if len < 10000
dr1 = [i for i in dr]
@test length(dr1) == len
@test findin(dr,dr) == [1:len]
@test length([dr]) == len
@test findin(dr,dr) == [1:len;]
@test length([dr;]) == len
end
@test !isempty(reverse(dr))
@test length(reverse(dr)) == len
Expand Down Expand Up @@ -256,7 +256,7 @@ drs2 = map(x->Dates.Date(first(x)):step(x):Dates.Date(last(x)),drs)
@test map(length,drs) == map(x->size(x)[1],drs)
@test map(length,drs) == map(x->length(Dates.Date(first(x)):step(x):Dates.Date(last(x))),drs)
@test map(length,drs) == map(x->length(reverse(x)),drs)
@test all(map(x->findin(x,x)==[1:length(x)],drs[1:4]))
@test all(map(x->findin(x,x)==[1:length(x);],drs[1:4]))
@test isempty(dr2)
@test all(map(x->reverse(x) == range(last(x), -step(x), length(x)),drs))
@test all(map(x->minimum(x) == (step(x) < zero(step(x)) ? last(x) : first(x)),drs[4:end]))
Expand All @@ -270,8 +270,8 @@ end)
@test_throws MethodError dr + 1
a = Dates.DateTime(2013,1,1)
b = Dates.DateTime(2013,2,1)
@test map!(x->x+Dates.Day(1),Array(Dates.DateTime,32),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1))]
@test map(x->x+Dates.Day(1),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1))]
@test map!(x->x+Dates.Day(1),Array(Dates.DateTime,32),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1));]
@test map(x->x+Dates.Day(1),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1));]

@test map(x->a in x,drs[1:4]) == [true,true,false,true]
@test a in dr
Expand Down Expand Up @@ -334,7 +334,7 @@ drs = {dr,dr1,dr2,dr3,dr4,dr5,dr6,dr7,dr8,dr9,dr10,
dr11,dr12,dr13,dr14,dr15,dr16,dr17,dr18,dr19,dr20}

@test map(length,drs) == map(x->size(x)[1],drs)
@test all(map(x->findin(x,x)==[1:length(x)],drs[1:4]))
@test all(map(x->findin(x,x) == [1:length(x);], drs[1:4]))
@test isempty(dr2)
@test all(map(x->reverse(x) == last(x):-step(x):first(x),drs))
@test all(map(x->minimum(x) == (step(x) < zero(step(x)) ? last(x) : first(x)),drs[4:end]))
Expand All @@ -348,8 +348,8 @@ end)
@test_throws MethodError dr + 1
a = Dates.Date(2013,1,1)
b = Dates.Date(2013,2,1)
@test map!(x->x+Dates.Day(1),Array(Dates.Date,32),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1))]
@test map(x->x+Dates.Day(1),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1))]
@test map!(x->x+Dates.Day(1),Array(Dates.Date,32),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1));]
@test map(x->x+Dates.Day(1),dr) == [(a+Dates.Day(1)):(b+Dates.Day(1));]

@test map(x->a in x,drs[1:4]) == [true,true,false,true]
@test a in dr
Expand Down Expand Up @@ -400,9 +400,9 @@ b = Dates.Date(2013,2,1)

c = Dates.Date(2013,6,1)
@test length(a:Dates.Month(1):c) == 6
@test [a:Dates.Month(1):c] == [a + Dates.Month(1)*i for i in 0:5]
@test [a:Dates.Month(2):Dates.Date(2013,1,2)] == [a]
@test [c:Dates.Month(-1):a] == reverse([a:Dates.Month(1):c])
@test [a:Dates.Month(1):c;] == [a + Dates.Month(1)*i for i in 0:5]
@test [a:Dates.Month(2):Dates.Date(2013,1,2);] == [a]
@test [c:Dates.Month(-1):a;] == reverse([a:Dates.Month(1):c;])

@test length(range(Date(2000),366)) == 366
function testlengths(n)
Expand Down Expand Up @@ -490,4 +490,4 @@ testmonthranges2(100000)

# Issue 5
lastdaysofmonth = [Dates.Date(2014,i,Dates.daysinmonth(2014,i)) for i=1:12]
@test [Date(2014,1,31):Dates.Month(1):Date(2015)] == lastdaysofmonth
@test [Date(2014,1,31):Dates.Month(1):Date(2015);] == lastdaysofmonth
2 changes: 1 addition & 1 deletion test/perf/sparse/perf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ end
intinds = nothing
logicalinds = nothing # needs to be generated for a specific matrix size.
rangeinds = 121:237
orderedinds = [rangeinds]
orderedinds = [rangeinds;]
disorderedinds = orderedinds[randperm(length(orderedinds))]

inds = [(intinds, "integers"), (logicalinds, "logical array"), (rangeinds, "a range"),
Expand Down
2 changes: 1 addition & 1 deletion test/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ srand(0); rand(); x = rand(384);
@test rand(MersenneTwister(5294967296)) == 0.3498809918210497

# Test array filling, Issue #7643
@test rand(MersenneTwister(0), 1) == [0.8236475079774124]
@test rand(MersenneTwister(0), 1) == Float64[0.8236475079774124]
A = zeros(2, 2)
rand!(MersenneTwister(0), A)
@test A == [0.8236475079774124 0.16456579813368521;
Expand Down
4 changes: 2 additions & 2 deletions test/ranges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ end
# mean/median
for f in (mean, median)
for n = 2:5
@test f(2:n) == f([2:n])
@test_approx_eq f(2:0.1:n) f([2:0.1:n])
@test f(2:n) == f([2:n;])
@test_approx_eq f(2:0.1:n) f([2:0.1:n;])
end
end

Expand Down
Loading

0 comments on commit c4b81f4

Please sign in to comment.