Fix(Core): str, txt and tex methods for MOmonial with -1 in coef

This commit is contained in:
Bertrand Benjamin 2018-12-21 12:26:11 +01:00
parent 9a68b826a3
commit 827249e944

View File

@ -190,6 +190,27 @@ class MOMonomial(Molecule):
Molecule.__init__(self, _tree) Molecule.__init__(self, _tree)
def __str__(self):
if self._coefficient != -1:
return super(MOMonomial, self).__str__()
else:
return "- " + self.strpower.__str__()
@property
def __txt__(self):
if self._coefficient != -1:
return super(MOMonomial, self).__txt__
else:
return "- " + self.strpower.__txt__
@property
def __tex__(self):
if self._coefficient != -1:
return super(MOMonomial, self).__tex__
else:
return "- " + self.strpower.__tex__
@property @property
def coefficient(self): def coefficient(self):
return self._coefficient return self._coefficient