Skip to content

Commit ba0c997

Browse files
authored
show for constant array space (#324)
* show for constant array space * fix test
1 parent ff725e0 commit ba0c997

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/show.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,10 @@ function show(io::IO, f::Fun)
1010
print(io,")")
1111
end
1212

13-
function show(io::IO,f::Fun{<:ConstantSpace})
14-
print(io, only(coefficients(f)))
13+
function show(io::IO,f::Fun{<:Union{ConstantSpace, ArraySpace{<:ConstantSpace}}})
1514
d = domain(f)
16-
if d isa AnyDomain
17-
print(io, " anywhere")
18-
else
19-
print(io, " on ", d)
20-
end
15+
print(io, f(d isa AnyDomain ? 0.0 : leftendpoint(d)))
16+
print(io, d isa AnyDomain ? " anywhere" : " on " * string(d))
2117
end
2218

2319
## MultivariateFun

test/show.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@
4444
@test contains(s, repr(coefficients(f)))
4545

4646
f = Fun(ConstantSpace(0..1), [2])
47-
@test contains(repr(f), repr(coefficient(f, 1)))
47+
@test contains(repr(f), repr(f(0)))
4848
@test contains(repr(f), repr(domain(f)))
4949

5050
f = Fun(ConstantSpace(), [2])
51-
@test contains(repr(f), repr(coefficient(f, 1)))
51+
@test contains(repr(f), repr(f(0)))
52+
53+
f = Fun(ApproxFunBase.ArraySpace([ConstantSpace(0..1)]), [3])
54+
@test contains(repr(f), repr(f(0)))
5255
end
5356
@testset "Operator" begin
5457
@testset "QuotientSpace" begin

0 commit comments

Comments
 (0)