Skip to content

Commit

Permalink
tests: Resolve warnings by defining PropertyLayer dtypes
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
EwoutH authored and rht committed Jan 22, 2024
1 parent 665aebc commit b96db8f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand All @@ -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):
Expand Down

0 comments on commit b96db8f

Please sign in to comment.