@@ -30,23 +30,15 @@ def test_init(self, shape, homogeneous):
3030 if homogeneous :
3131 coords = np .column_stack ([coords , np .ones (shape [0 ])])
3232
33- expected_shape = (shape [0 ], shape [1 ] + homogeneous )
34-
3533 points = ps .Pointset (coords , homogeneous = homogeneous )
36- assert points .shape == expected_shape
3734 assert np .allclose (points .affine , np .eye (shape [1 ] + 1 ))
3835 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
4237
4338 points = ps .Pointset (coords , affine = np .diag ([2 ] * shape [1 ] + [1 ]), homogeneous = homogeneous )
44- assert points .shape == expected_shape
4539 assert np .allclose (points .affine , np .diag ([2 ] * shape [1 ] + [1 ]))
4640 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
5042
5143 # Badly shaped affine
5244 with pytest .raises (ValueError ):
@@ -148,7 +140,8 @@ def test_from_image(self, shape):
148140 grid = ps .Grid .from_image (img )
149141 grid_coords = grid .get_coords ()
150142
151- assert grid .shape == (prod (shape [:3 ]), 3 )
143+ assert grid .n_coords == prod (shape [:3 ])
144+ assert grid .dim == 3
152145 assert np .allclose (grid .affine , affine )
153146
154147 assert np .allclose (grid_coords [0 ], [0 , 0 , 0 ])
@@ -164,7 +157,8 @@ def test_from_mask(self):
164157 grid = ps .Grid .from_mask (img )
165158 grid_coords = grid .get_coords ()
166159
167- assert grid .shape == (1 , 3 )
160+ assert grid .n_coords == 1
161+ assert grid .dim == 3
168162 assert np .array_equal (grid_coords , [[2 , 3 , 4 ]])
169163
170164 def test_to_mask (self ):
0 commit comments