From b96db8f91192c6a4ed184be45b534be8f2c83cd1 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Mon, 22 Jan 2024 11:26:33 +0100 Subject: [PATCH] tests: Resolve warnings by defining PropertyLayer dtypes Resolve warnings in the space tests by defining PropertyLayer dtypes, by either defining dtype=int or setting the default value from an int (like 1) to a float (like 1.0). --- tests/test_space.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_space.py b/tests/test_space.py index 539d2c0e9f1..aabdf98ba8d 100644 --- a/tests/test_space.py +++ b/tests/test_space.py @@ -280,7 +280,7 @@ def test_remove_middle(self): class TestPropertyLayer(unittest.TestCase): def setUp(self): - self.layer = PropertyLayer("test_layer", 10, 10, 0) + self.layer = PropertyLayer("test_layer", 10, 10, 0, dtype=int) # Initialization Test def test_initialization(self): @@ -379,11 +379,11 @@ def test_aggregate_property_ufunc(self): # Edge Case: Negative or Zero Dimensions def test_initialization_negative_dimensions(self): with self.assertRaises(ValueError): - PropertyLayer("test_layer", -10, 10, 0) + PropertyLayer("test_layer", -10, 10, 0, dtype=int) def test_initialization_zero_dimensions(self): with self.assertRaises(ValueError): - PropertyLayer("test_layer", 0, 10, 0) + PropertyLayer("test_layer", 0, 10, 0, dtype=int) # Edge Case: Out-of-Bounds Cell Access def test_set_cell_out_of_bounds(self): @@ -611,8 +611,8 @@ def test_distance_squared_torus(self): class TestSingleGridWithPropertyGrid(unittest.TestCase): def setUp(self): self.grid = SingleGrid(10, 10, False) - self.property_layer1 = PropertyLayer("layer1", 10, 10, 0) - self.property_layer2 = PropertyLayer("layer2", 10, 10, 1) + self.property_layer1 = PropertyLayer("layer1", 10, 10, 0, dtype=int) + self.property_layer2 = PropertyLayer("layer2", 10, 10, 1.0, dtype=float) self.grid.add_property_layer(self.property_layer1) self.grid.add_property_layer(self.property_layer2) @@ -627,7 +627,7 @@ def test_remove_property_layer(self): def test_add_property_layer_mismatched_dimensions(self): with self.assertRaises(ValueError): - self.grid.add_property_layer(PropertyLayer("layer3", 5, 5, 0)) + self.grid.add_property_layer(PropertyLayer("layer3", 5, 5, 0, dtype=int)) def test_add_existing_property_layer(self): with self.assertRaises(ValueError):