Skip to content

Commit 50281d2

Browse files
authored
Merge pull request #519 from JuliaSymbolics/s/fix-print-tests
fix print tests
2 parents cda830f + ef02bab commit 50281d2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/types.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,9 @@ function show_term(io::IO, t)
811811

812812
f = operation(t)
813813
args = arguments(t)
814-
815-
if f === (+)
814+
if symtype(t) <: LiteralReal
815+
show_call(io, f, args)
816+
elseif f === (+)
816817
show_add(io, args)
817818
elseif f === (*)
818819
show_mul(io, args)

test/basics.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ end
173173
@syms a b c
174174
@test repr(a+b) == "a + b"
175175
@test repr(-a) == "-a"
176-
@test repr(term(-, a; type = Real)) == "-(a)"
176+
@test repr(term(-, a; type = Real)) == "-a"
177177
@test repr(-a + 3) == "3 - a"
178178
@test repr(-(a + b)) == "-a - b"
179179
@test repr((2a)^(-2a)) == "(2a)^(-2a)"
@@ -280,8 +280,8 @@ end
280280
@testset "LiteralReal" begin
281281
@syms x::LiteralReal y::LiteralReal z::LiteralReal
282282
@test repr(x+x) == "x + x"
283-
@test repr(x*x) == "x*x"
284-
@test repr(x*x + x*x) == "x*x + x*x"
283+
@test repr(x*x) == "x * x"
284+
@test repr(x*x + x*x) == "(x * x) + (x * x)"
285285
for ex in [sin(x), x+x, x*x, x\x, x/x]
286286
@test typeof(sin(x)) <: BasicSymbolic{LiteralReal}
287287
end

0 commit comments

Comments
 (0)