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
1 changed files with 21 additions and 0 deletions

View File

@ -190,6 +190,27 @@ class MOMonomial(Molecule):
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
def coefficient(self):
return self._coefficient