From 0e479323ddb3f36a18e675c8330cad8fd2479745 Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Mon, 24 Sep 2018 15:47:47 +0200 Subject: [PATCH] Test(core): Write doctest on computing with fractions --- mapytex/calculus/core/__init__.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/mapytex/calculus/core/__init__.py b/mapytex/calculus/core/__init__.py index 9297e9a..4f8c550 100644 --- a/mapytex/calculus/core/__init__.py +++ b/mapytex/calculus/core/__init__.py @@ -18,7 +18,7 @@ Abstracts tools for calculs manipulations > * | > 3 | > 4 ->>> print(t.apply_on_last_level(compute)) +>>> print(t.apply_on_last_level(compute, typing)) + > 2 > 12 @@ -26,6 +26,26 @@ Abstracts tools for calculs manipulations '2 + 3 * 4' >>> tree2tex(t) '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") >>> print(t) + @@ -38,6 +58,7 @@ Abstracts tools for calculs manipulations from .tree import Tree from .compute import compute +from .typing import typing from .renders import tree2txt, tree2tex