@@ -30,23 +30,15 @@ def test_init(self, shape, homogeneous):
30
30
if homogeneous :
31
31
coords = np .column_stack ([coords , np .ones (shape [0 ])])
32
32
33
- expected_shape = (shape [0 ], shape [1 ] + homogeneous )
34
-
35
33
points = ps .Pointset (coords , homogeneous = homogeneous )
36
- assert points .shape == expected_shape
37
34
assert np .allclose (points .affine , np .eye (shape [1 ] + 1 ))
38
35
assert points .homogeneous is homogeneous
39
- assert points .ndim == 2
40
- assert points .n_coords == shape [0 ]
41
- assert points .dim == shape [1 ]
36
+ assert (points .n_coords , points .dim ) == shape
42
37
43
38
points = ps .Pointset (coords , affine = np .diag ([2 ] * shape [1 ] + [1 ]), homogeneous = homogeneous )
44
- assert points .shape == expected_shape
45
39
assert np .allclose (points .affine , np .diag ([2 ] * shape [1 ] + [1 ]))
46
40
assert points .homogeneous is homogeneous
47
- assert points .ndim == 2
48
- assert points .n_coords == shape [0 ]
49
- assert points .dim == shape [1 ]
41
+ assert (points .n_coords , points .dim ) == shape
50
42
51
43
# Badly shaped affine
52
44
with pytest .raises (ValueError ):
@@ -148,7 +140,8 @@ def test_from_image(self, shape):
148
140
grid = ps .Grid .from_image (img )
149
141
grid_coords = grid .get_coords ()
150
142
151
- assert grid .shape == (prod (shape [:3 ]), 3 )
143
+ assert grid .n_coords == prod (shape [:3 ])
144
+ assert grid .dim == 3
152
145
assert np .allclose (grid .affine , affine )
153
146
154
147
assert np .allclose (grid_coords [0 ], [0 , 0 , 0 ])
@@ -164,7 +157,8 @@ def test_from_mask(self):
164
157
grid = ps .Grid .from_mask (img )
165
158
grid_coords = grid .get_coords ()
166
159
167
- assert grid .shape == (1 , 3 )
160
+ assert grid .n_coords == 1
161
+ assert grid .dim == 3
168
162
assert np .array_equal (grid_coords , [[2 , 3 , 4 ]])
169
163
170
164
def test_to_mask (self ):
0 commit comments