Skip to content

Commit d496121

Browse files
committed
Fix remaining TestPropertyLayer
A condition always is a function, never a mask (for now).
1 parent e3c8bc9 commit d496121

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/test_space.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,13 @@ def test_set_cells_no_condition(self):
300300
np.testing.assert_array_equal(self.layer.data, np.full((10, 10), 2))
301301

302302
def test_set_cells_with_condition(self):
303-
condition = np.full((10, 10), False)
304-
condition[5, :] = True # Only update the 5th row
303+
self.layer.set_cell((5, 5), 1)
304+
condition = lambda x: x == 0
305305
self.layer.set_cells(3, condition)
306-
self.assertEqual(np.sum(self.layer.data[5, :] == 3), 10)
307-
self.assertEqual(np.sum(self.layer.data != 3), 90)
308-
309-
def test_set_cells_invalid_condition(self):
310-
with self.assertRaises(ValueError):
311-
self.layer.set_cells(4, condition=np.full((5, 5), False)) # Invalid shape
306+
self.assertEqual(self.layer.data[5, 5], 1)
307+
self.assertEqual(self.layer.data[0, 0], 3)
308+
# Check if the sum is correct
309+
self.assertEqual(np.sum(self.layer.data), 3*99+1)
312310

313311
# Modify Cells Test
314312
def test_modify_cell_lambda(self):

0 commit comments

Comments
 (0)