Further comparison operations and test implemented

This commit is contained in:
Fabian Joswig 2021-10-18 13:07:33 +01:00
parent 8d7a5daafa
commit 0c83f7a607
2 changed files with 16 additions and 0 deletions

View file

@ -485,9 +485,21 @@ class Obs:
def __lt__(self, other):
return self.value < other
def __le__(self, other):
return self.value <= other
def __gt__(self, other):
return self.value > other
def __ge__(self, other):
return self.value >= other
def __eq__(self, other):
return (self - other).is_zero()
def __ne__(self, other):
return not (self - other).is_zero()
# Overload math operations
def __add__(self, y):
if isinstance(y, Obs):