Test(core): Write doctest on computing with fractions

This commit is contained in:
Bertrand Benjamin 2018-09-24 15:47:47 +02:00
parent d09d8a3d98
commit 0e479323dd
1 changed files with 22 additions and 1 deletions

View File

@ -18,7 +18,7 @@ Abstracts tools for calculs manipulations
> * > *
| > 3 | > 3
| > 4 | > 4
>>> print(t.apply_on_last_level(compute)) >>> print(t.apply_on_last_level(compute, typing))
+ +
> 2 > 2
> 12 > 12
@ -26,6 +26,26 @@ Abstracts tools for calculs manipulations
'2 + 3 * 4' '2 + 3 * 4'
>>> tree2tex(t) >>> tree2tex(t)
'2 + 3 \\times 4' '2 + 3 \\times 4'
>>> t = Tree.from_str("2+3/4")
>>> print(t)
+
> 2
> /
| > 3
| > 4
>>> print(t.apply_on_last_level(compute, typing))
+
> /
| > *
| | > 2
| | > 4
| > 4
> /
| > 3
| > 4
>>> t = Tree.from_str("2+3x") >>> t = Tree.from_str("2+3x")
>>> print(t) >>> print(t)
+ +
@ -38,6 +58,7 @@ Abstracts tools for calculs manipulations
from .tree import Tree from .tree import Tree
from .compute import compute from .compute import compute
from .typing import typing
from .renders import tree2txt, tree2tex from .renders import tree2txt, tree2tex