From 95fd12c43098571abe178b29f9bb337127bc0fee Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Tue, 15 Dec 2020 15:02:39 +0100 Subject: [PATCH] Feat: test num and denom for fraction --- mapytex/calculus/API/tokens/number.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mapytex/calculus/API/tokens/number.py b/mapytex/calculus/API/tokens/number.py index d321291..e8fa653 100644 --- a/mapytex/calculus/API/tokens/number.py +++ b/mapytex/calculus/API/tokens/number.py @@ -18,7 +18,7 @@ from ...core.MO import MO, MOnumber from ...core.MO.fraction import MOFraction from random import random -__all__ = ["Integer", "Decimal"] +__all__ = ["Integer", "Decimal", "Fraction"] class Integer(Token): @@ -237,11 +237,25 @@ class Fraction(Token): @property def numerator(self): - return self._mo.numerator + """ Get numerator of the fraction + + :example: + >>> a = Fraction("3/4") + >>> a.numerator + + """ + return Integer(self._mo.numerator) @property def denominator(self): - return self._mo.denominator + """ Get denominator of the fraction + + :example: + >>> a = Fraction("3/4") + >>> a.denominator + + """ + return Integer(self._mo.denominator) @property def decimal(self):