diff --git a/src/common.jl b/src/common.jl index b5465360..f569248b 100644 --- a/src/common.jl +++ b/src/common.jl @@ -647,7 +647,6 @@ function Base.map(fn, p::P, args...) where {P<:AbstractPolynomial} return ⟒(P){R,X}(xs) end - """ isreal(p::AbstractPolynomial) diff --git a/test/StandardBasis.jl b/test/StandardBasis.jl index f9ef0784..c1ce6e46 100644 --- a/test/StandardBasis.jl +++ b/test/StandardBasis.jl @@ -1186,6 +1186,23 @@ end end end +@testset "map/any/all" begin + # map over a polynomial and return a polynomial + p = Polynomial([1,2,3]) + pp = map(float,p) + @test !(eltype(p) <: AbstractFloat) + @test eltype(pp) <: AbstractFloat + @test pp ≈ p + @test all(isinteger, p) + @test any(>=(2), p) + + p = Polynomial([im, 2, 3]) + q = Polynomial([0,2,3]) + @test map(real, p) == q + + v = [1,2,3] + @test map(sin, Polynomial(v)) == Polynomial(sin.(v)) +end @testset "As matrix elements" begin