Finish unify_render! :D and even mod the doc

This commit is contained in:
Lafrite
2014-08-29 17:15:29 +02:00
parent 71b4c987ec
commit 412149f22d
3 changed files with 50 additions and 39 deletions

View File

@@ -8,7 +8,7 @@ import unittest
from pymath.expression import Expression
from pymath.fraction import Fraction
from pymath.generic import first_elem
from pymath.renders import txt
from pymath.renders import txt, tex
class TestExpression(unittest.TestCase):
@@ -76,6 +76,7 @@ class TestExpression(unittest.TestCase):
def test_simplify_frac(self):
exp = Expression("1/2 - 4")
Expression.STR_RENDER = lambda _,x : str(x)
steps = ["[1, 2, '/', 4, '-']", \
"[< Fraction 1 / 2>, 4, '-']", \
"[1, 1, '*', 2, 1, '*', '/', 4, 2, '*', 1, 2, '*', '/', '-']", \
@@ -83,6 +84,8 @@ class TestExpression(unittest.TestCase):
'[< Fraction -7 / 2>]']
self.assertEqual(steps, list(exp.simplify()))
Expression.STR_RENDER = tex
if __name__ == '__main__':
unittest.main()