You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
from sympy.core.relational import Eq
|
|
|
|
|
from sympy.core.symbol import Symbol
|
|
|
|
|
from sympy.functions.elementary.piecewise import Piecewise
|
|
|
|
|
from sympy.printing.preview import preview
|
|
|
|
|
|
|
|
|
|
from io import BytesIO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_preview():
|
|
|
|
|
x = Symbol('x')
|
|
|
|
|
obj = BytesIO()
|
|
|
|
|
try:
|
|
|
|
|
preview(x, output='png', viewer='BytesIO', outputbuffer=obj)
|
|
|
|
|
except RuntimeError:
|
|
|
|
|
pass # latex not installed on CI server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_preview_unicode_symbol():
|
|
|
|
|
# issue 9107
|
|
|
|
|
a = Symbol('α')
|
|
|
|
|
obj = BytesIO()
|
|
|
|
|
try:
|
|
|
|
|
preview(a, output='png', viewer='BytesIO', outputbuffer=obj)
|
|
|
|
|
except RuntimeError:
|
|
|
|
|
pass # latex not installed on CI server
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_preview_latex_construct_in_expr():
|
|
|
|
|
# see PR 9801
|
|
|
|
|
x = Symbol('x')
|
|
|
|
|
pw = Piecewise((1, Eq(x, 0)), (0, True))
|
|
|
|
|
obj = BytesIO()
|
|
|
|
|
try:
|
|
|
|
|
preview(pw, output='png', viewer='BytesIO', outputbuffer=obj)
|
|
|
|
|
except RuntimeError:
|
|
|
|
|
pass # latex not installed on CI server
|