Skip to content

Commit 32f4a1f

Browse files
committed
IO fixes
1 parent 54552ad commit 32f4a1f

File tree

2 files changed

+13
-45
lines changed

2 files changed

+13
-45
lines changed

src/io.jl

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# after this, functionality was incorporated into Base
21
function Base.showarg(io::IO, A::BSplineInterpolation{T,N,TW,ST,GT}, toplevel) where {T,N,TW,ST,GT}
32
print(io, "interpolate(")
43
Base.showarg(io, A.coefs, false)
54
print(io, ", ")
6-
_showtypeparam(io, ST)
7-
print(io, ", ")
8-
_showtypeparam(io, GT)
5+
show(io, itpflag(A))
96
if toplevel
107
print(io, ") with element type ",T)
118
else
@@ -66,32 +63,3 @@ end
6663
# print(io, " with element type ",T)
6764
# end
6865
# end
69-
70-
_showtypeparam(io, ::Type{T}) where {T} =
71-
print(io, T.name.name, "()")
72-
_showtypeparam(io, ::Type{Quadratic{T}}) where {T} =
73-
print(io, "Quadratic(", T.name.name, "())")
74-
_showtypeparam(io, ::Type{Cubic{T}}) where {T} =
75-
print(io, "Cubic(", T.name.name, "())")
76-
77-
function _showtypeparam(io, ::Type{BSpline{T}}) where T
78-
print(io, "BSpline(")
79-
_showtypeparam(io, T)
80-
print(io, ')')
81-
end
82-
83-
# function _showtypeparam(io, ::Type{Gridded{T}}) where T
84-
# print(io, "Gridded(")
85-
# _showtypeparam(io, T)
86-
# print(io, ')')
87-
# end
88-
89-
function _showtypeparam(io, types::Type{TTup}) where TTup<:Tuple
90-
print(io, '(')
91-
N = length(types.types)
92-
for (i, T) in enumerate(types.types)
93-
_showtypeparam(io, T)
94-
i < N && print(io, ", ")
95-
end
96-
print(io, ')')
97-
end

test/io.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ using Test
77
@testset "BSpline" begin
88
A = rand(8,20)
99

10-
itp = interpolate(A, BSpline(Constant()), OnCell())
11-
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Constant()), OnCell()) with element type Float64"
10+
itp = interpolate(A, BSpline(Constant()))
11+
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Constant())) with element type Float64"
1212

13-
itp = interpolate(A, BSpline(Constant()), OnGrid())
14-
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Constant()), OnGrid()) with element type Float64"
13+
itp = interpolate(A, BSpline(Constant()))
14+
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Constant())) with element type Float64"
1515

16-
itp = interpolate(A, BSpline(Linear()), OnGrid())
17-
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Linear()), OnGrid()) with element type Float64"
16+
itp = interpolate(A, BSpline(Linear()))
17+
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Linear())) with element type Float64"
1818

19-
itp = interpolate(A, BSpline(Quadratic(Reflect())), OnCell())
20-
@test summary(itp) == "8×20 interpolate(OffsetArray(::Array{Float64,2}, 0:9, 0:21), BSpline(Quadratic(Reflect())), OnCell()) with element type Float64"
19+
itp = interpolate(A, BSpline(Quadratic(Reflect(OnCell()))))
20+
@test summary(itp) == "8×20 interpolate(OffsetArray(::Array{Float64,2}, 0:9, 0:21), BSpline(Quadratic(Reflect(OnCell())))) with element type Float64"
2121

22-
itp = interpolate(A, (BSpline(Linear()), NoInterp()), OnGrid())
23-
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, (BSpline(Linear()), NoInterp()), OnGrid()) with element type Float64"
22+
itp = interpolate(A, (BSpline(Linear()), NoInterp()))
23+
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, (BSpline(Linear()), NoInterp())) with element type Float64"
2424

25-
itp = interpolate!(copy(A), BSpline(Quadratic(InPlace())), OnCell())
26-
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Quadratic(InPlace())), OnCell()) with element type Float64"
25+
itp = interpolate!(copy(A), BSpline(Quadratic(InPlace(OnCell()))))
26+
@test summary(itp) == "8×20 interpolate(::Array{Float64,2}, BSpline(Quadratic(InPlace(OnCell())))) with element type Float64"
2727
end
2828

2929
# @testset "Gridded" begin

0 commit comments

Comments
 (0)