2021-09-25 16:05:05 +00:00
|
|
|
import mapytex
|
|
|
|
|
|
|
|
def test_default_render():
|
|
|
|
assert mapytex.render.render_name == "txt"
|
|
|
|
|
|
|
|
def test_default_rending():
|
|
|
|
e = mapytex.Expression("2*3")
|
|
|
|
assert str(e) == "2*3"
|
|
|
|
|
|
|
|
def test_changing_render():
|
|
|
|
assert mapytex.render.render_name == "txt"
|
|
|
|
mapytex.render.set_render("tex")
|
|
|
|
assert mapytex.render.render_name == "tex"
|
|
|
|
mapytex.render.set_render("txt")
|
|
|
|
assert mapytex.render.render_name == "txt"
|
|
|
|
|
|
|
|
|
|
|
|
def test_changing_rending():
|
|
|
|
e = mapytex.Expression.from_str("2*3")
|
2021-10-09 13:22:58 +00:00
|
|
|
f = mapytex.Expression.from_str("2/3")
|
2021-09-25 16:05:05 +00:00
|
|
|
assert str(e) == "2 * 3"
|
|
|
|
assert str(f) == "2 / 3"
|
|
|
|
mapytex.render.set_render("tex")
|
|
|
|
assert str(e) == "2 \\times 3"
|
|
|
|
assert str(f) == "\\dfrac{2}{3}"
|
|
|
|
mapytex.render.set_render("txt")
|
|
|
|
assert str(e) == "2 * 3"
|
|
|
|
assert str(f) == "2 / 3"
|
|
|
|
|
|
|
|
|
|
|
|
|