Feat(Core): Change default str function for MO

This commit is contained in:
2018-12-21 12:20:13 +01:00
parent 092fd3c0a7
commit 9a68b826a3
10 changed files with 159 additions and 513 deletions

View File

@@ -35,9 +35,7 @@ class MOFraction(Molecule):
>>> print(f.__tex__)
\\frac{2}{3}
>>> print(f)
/
> 2
> 3
2 / 3
>>> f = MOFraction(2, 3, negative = True)
>>> f
<MOFraction - 2 / 3>

View File

@@ -185,8 +185,7 @@ class Molecule(MO):
return self._tree
def __str__(self):
# TODO: à changer pour utiliser .__txt__ |ven. déc. 21 08:30:33 CET 2018
return str(self.tree)
return str(self.__txt__)
@property
def __txt__(self):

View File

@@ -29,9 +29,7 @@ class MOstrPower(Molecule):
>>> s
<MOstrPower x^2>
>>> print(s)
^
> x
> 2
x^2
>>> print(s.__txt__)
x^2
>>> print(s.__tex__)
@@ -133,9 +131,7 @@ class MOMonomial(Molecule):
>>> m
<MOMonomial 4x>
>>> print(m)
*
> 4
> x
4x
>>> print(m.__txt__)
4x
>>> print(m.__tex__)
@@ -147,9 +143,7 @@ class MOMonomial(Molecule):
>>> m
<MOMonomial 4x>
>>> print(m)
*
> 4
> x
4x
>>> print(m.__txt__)
4x
>>> print(m.__tex__)