diff --git a/python/BioSimSpace/Sandpit/Exscientia/Types/_type.py b/python/BioSimSpace/Sandpit/Exscientia/Types/_type.py index 25912a900..f01635631 100644 --- a/python/BioSimSpace/Sandpit/Exscientia/Types/_type.py +++ b/python/BioSimSpace/Sandpit/Exscientia/Types/_type.py @@ -388,26 +388,6 @@ def __eq__(self, other): else: return False - def __ne__(self, other): - """Not equals to operator.""" - - # Compare to another object of the same type. - if type(other) is type(self): - return _math.isclose( - self._to_default_unit().value(), - other._to_default_unit().value(), - ) - - # Compare with a string. - elif isinstance(other, str): - return not _math.isclose( - self._to_default_unit().value(), - self._from_string(other)._to_default_unit().value(), - ) - - else: - return True - def __ge__(self, other): """Greater than or equal to operator.""" diff --git a/python/BioSimSpace/Types/_type.py b/python/BioSimSpace/Types/_type.py index 25912a900..f01635631 100644 --- a/python/BioSimSpace/Types/_type.py +++ b/python/BioSimSpace/Types/_type.py @@ -388,26 +388,6 @@ def __eq__(self, other): else: return False - def __ne__(self, other): - """Not equals to operator.""" - - # Compare to another object of the same type. - if type(other) is type(self): - return _math.isclose( - self._to_default_unit().value(), - other._to_default_unit().value(), - ) - - # Compare with a string. - elif isinstance(other, str): - return not _math.isclose( - self._to_default_unit().value(), - self._from_string(other)._to_default_unit().value(), - ) - - else: - return True - def __ge__(self, other): """Greater than or equal to operator.""" diff --git a/tests/Sandpit/Exscientia/Types/test_types.py b/tests/Sandpit/Exscientia/Types/test_types.py index f7549286b..efeb6dbf8 100644 --- a/tests/Sandpit/Exscientia/Types/test_types.py +++ b/tests/Sandpit/Exscientia/Types/test_types.py @@ -134,3 +134,21 @@ def test_container_mul(Type): # Assert we have a container of the original type. assert all(isinstance(x, Type) for x in container) + + +@pytest.mark.parametrize("Type", types) +def test_equality(Type): + """Test equality operators.""" + + t0 = Type(1.0, Type._default_unit) + t1 = Type(2.0, Type._default_unit) + t2 = Type(3.0, Type._default_unit) + + assert t0 == t0 + assert t0 <= t0 + assert t0 >= t0 + assert t0 != t1 + assert t0 < t1 + assert t1 > t0 + assert t1 < t2 + assert t2 > t1 diff --git a/tests/Types/test_types.py b/tests/Types/test_types.py index 32098b77f..ee2f1b55d 100644 --- a/tests/Types/test_types.py +++ b/tests/Types/test_types.py @@ -134,3 +134,21 @@ def test_container_mul(Type): # Assert we have a container of the original type. assert all(isinstance(x, Type) for x in container) + + +@pytest.mark.parametrize("Type", types) +def test_equality(Type): + """Test equality operators.""" + + t0 = Type(1.0, Type._default_unit) + t1 = Type(2.0, Type._default_unit) + t2 = Type(3.0, Type._default_unit) + + assert t0 == t0 + assert t0 <= t0 + assert t0 >= t0 + assert t0 != t1 + assert t0 < t1 + assert t1 > t0 + assert t1 < t2 + assert t2 > t1