We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e3c8bc9 commit d496121Copy full SHA for d496121
tests/test_space.py
@@ -300,15 +300,13 @@ def test_set_cells_no_condition(self):
300
np.testing.assert_array_equal(self.layer.data, np.full((10, 10), 2))
301
302
def test_set_cells_with_condition(self):
303
- condition = np.full((10, 10), False)
304
- condition[5, :] = True # Only update the 5th row
+ self.layer.set_cell((5, 5), 1)
+ condition = lambda x: x == 0
305
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
+ self.assertEqual(self.layer.data[5, 5], 1)
+ self.assertEqual(self.layer.data[0, 0], 3)
+ # Check if the sum is correct
+ self.assertEqual(np.sum(self.layer.data), 3*99+1)
312
313
# Modify Cells Test
314
def test_modify_cell_lambda(self):
0 commit comments