added test for appending rotation lists; better check for type==list

This commit is contained in:
Philip Eisenlohr 2020-12-28 12:26:09 -05:00
parent 4796afdd92
commit da62daf15d
2 changed files with 9 additions and 1 deletions

View File

@ -213,7 +213,7 @@ class Rotation:
"""
return self.copy(rotation=np.vstack(tuple(map(lambda x:x.quaternion,
[self]+other if type(other) == list else [self,other]))))
[self]+other if isinstance(other,list) else [self,other]))))
def flatten(self,order = 'C'):

View File

@ -800,6 +800,14 @@ class TestRotation:
print(f'append 2x {shape} --> {s.shape}')
assert s[0,...] == r[0,...] and s[-1,...] == p[-1,...]
@pytest.mark.parametrize('shape',[None,1,(1,),(4,2),(3,3,2)])
def test_append_list(self,shape):
r = Rotation.from_random(shape=shape)
p = Rotation.from_random(shape=shape)
s = r.append([r,p])
print(f'append 3x {shape} --> {s.shape}')
assert s[0,...] == r[0,...] and s[-1,...] == p[-1,...]
@pytest.mark.parametrize('quat,standardized',[
([-1,0,0,0],[1,0,0,0]),
([-0.5,-0.5,-0.5,-0.5],[0.5,0.5,0.5,0.5]),