Fix: fraction rendering
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-09-25 18:05:05 +02:00
parent cbcead48f7
commit 78ce8f767a
8 changed files with 47 additions and 6 deletions

View File

@@ -141,7 +141,7 @@ class Decimal(Token):
class Fraction(Token):
""" Token representing a fraction
""" Token representing a fraction of numbers
:example:
>>> Fraction("3/4")

View File

@@ -54,10 +54,16 @@ class Token(object):
yield self
def __repr__(self):
return f"<{self.__class__.__name__} {render(self._mo, 'txt')}>"
try:
return f"<{self.__class__.__name__} {render(self._mo._tree, 'txt')}>"
except AttributeError:
return f"<{self.__class__.__name__} {render(self._mo, 'txt')}>"
def __str__(self):
return render(self._mo)
try:
return render(self._mo._tree)
except AttributeError:
return render(self._mo)
@property
def raw(self):