__ne__ is automatically set to !__eq__, __neq__ has no special meaning

This commit is contained in:
Martin Diehl 2020-11-15 11:38:26 +01:00
parent 51e5dda702
commit 15af12bbb4
2 changed files with 8 additions and 23 deletions

View File

@ -107,22 +107,6 @@ class Rotation:
and np.allclose(self.quaternion,other.quaternion)
def __neq__(self,other):
"""
Not Equal to other.
Equality is determined taking limited floating point precision into
account. See numpy.allclose for details.
Parameters
----------
other : Rotation
Rotation to check for inequality.
"""
return not self.__eq__(other)
@property
def shape(self):
return self.quaternion.shape[:-1]

View File

@ -769,15 +769,16 @@ class TestRotation:
@pytest.mark.parametrize('shape',[None,1,(4,4)])
def test_random(self,shape):
Rotation.from_random(shape)
r = Rotation.from_random(shape)
if shape is None:
assert r.shape == ()
elif shape == 1:
assert r.shape == (1,)
else:
assert r.shape == shape
def test_equal(self):
r = Rotation.from_random()
assert r == r
def test_unequal(self):
r = Rotation.from_random()
assert not (r != r)
assert Rotation.from_random(seed=1) == Rotation.from_random(seed=1)
def test_inversion(self):
r = Rotation.from_random()