1# -*- coding: utf-8 -*-
2
3from sympy import Symbol, Piecewise, Eq
4from sympy.printing.preview import preview
5
6from io import BytesIO
7
8
9def test_preview():
10    x = Symbol('x')
11    obj = BytesIO()
12    try:
13        preview(x, output='png', viewer='BytesIO', outputbuffer=obj)
14    except RuntimeError:
15        pass  # latex not installed on CI server
16
17
18def test_preview_unicode_symbol():
19    # issue 9107
20    a = Symbol('α')
21    obj = BytesIO()
22    try:
23        preview(a, output='png', viewer='BytesIO', outputbuffer=obj)
24    except RuntimeError:
25        pass  # latex not installed on CI server
26
27
28def test_preview_latex_construct_in_expr():
29    # see PR 9801
30    x = Symbol('x')
31    pw = Piecewise((1, Eq(x, 0)), (0, True))
32    obj = BytesIO()
33    try:
34        preview(pw, output='png', viewer='BytesIO', outputbuffer=obj)
35    except RuntimeError:
36        pass  # latex not installed on CI server
37