@@ -42,7 +42,7 @@ def test_agents_add_many(self):
4242 """
4343 positions = np .random .rand (TEST_AGENTS_PERF , 2 )
4444 for i in range (TEST_AGENTS_PERF ):
45- a = MockAgent (i , None )
45+ a = MockAgent (i )
4646 pos = [positions [i , 0 ], positions [i , 1 ]]
4747 self .space .place_agent (a , pos )
4848
@@ -59,7 +59,7 @@ def setUp(self):
5959 self .space = ContinuousSpace (70 , 20 , True , - 30 , - 30 )
6060 self .agents = []
6161 for i , pos in enumerate (TEST_AGENTS ):
62- a = MockAgent (i , None )
62+ a = MockAgent (i )
6363 self .agents .append (a )
6464 self .space .place_agent (a , pos )
6565
@@ -126,7 +126,7 @@ def test_bounds(self):
126126 """
127127 boundary_agents = []
128128 for i , pos in enumerate (OUTSIDE_POSITIONS ):
129- a = MockAgent (len (self .agents ) + i , None )
129+ a = MockAgent (len (self .agents ) + i )
130130 boundary_agents .append (a )
131131 self .space .place_agent (a , pos )
132132
@@ -152,7 +152,7 @@ def setUp(self):
152152 self .space = ContinuousSpace (70 , 20 , False , - 30 , - 30 )
153153 self .agents = []
154154 for i , pos in enumerate (TEST_AGENTS ):
155- a = MockAgent (i , None )
155+ a = MockAgent (i )
156156 self .agents .append (a )
157157 self .space .place_agent (a , pos )
158158
@@ -208,7 +208,7 @@ def test_bounds(self):
208208 Test positions outside of boundary
209209 """
210210 for i , pos in enumerate (OUTSIDE_POSITIONS ):
211- a = MockAgent (len (self .agents ) + i , None )
211+ a = MockAgent (len (self .agents ) + i )
212212 with self .assertRaises (Exception ):
213213 self .space .place_agent (a , pos )
214214
@@ -231,7 +231,7 @@ def setUp(self):
231231 self .space = ContinuousSpace (70 , 50 , False , - 30 , - 30 )
232232 self .agents = []
233233 for i , pos in enumerate (REMOVAL_TEST_AGENTS ):
234- a = MockAgent (i , None )
234+ a = MockAgent (i )
235235 self .agents .append (a )
236236 self .space .place_agent (a , pos )
237237
@@ -442,7 +442,7 @@ def setUp(self):
442442 self .space = SingleGrid (50 , 50 , False )
443443 self .agents = []
444444 for i , pos in enumerate (TEST_AGENTS_GRID ):
445- a = MockAgent (i , None )
445+ a = MockAgent (i )
446446 self .agents .append (a )
447447 self .space .place_agent (a , pos )
448448
@@ -466,7 +466,7 @@ def test_remove_agent(self):
466466 def test_empty_cells (self ):
467467 if self .space .exists_empty_cells ():
468468 for i , pos in enumerate (list (self .space .empties )):
469- a = MockAgent (- i , pos )
469+ a = MockAgent (- i )
470470 self .space .place_agent (a , pos )
471471 with self .assertRaises (Exception ):
472472 self .space .move_to_empty (a )
@@ -551,7 +551,7 @@ def setUp(self):
551551 self .space = SingleGrid (50 , 50 , True ) # Torus is True here
552552 self .agents = []
553553 for i , pos in enumerate (TEST_AGENTS_GRID ):
554- a = MockAgent (i , None )
554+ a = MockAgent (i )
555555 self .agents .append (a )
556556 self .space .place_agent (a , pos )
557557
@@ -643,7 +643,7 @@ def test_get_empty_mask(self):
643643 self .assertTrue (np .all (empty_mask == np .ones ((10 , 10 ), dtype = bool )))
644644
645645 def test_get_empty_mask_with_agent (self ):
646- agent = MockAgent (0 , self . grid )
646+ agent = MockAgent (0 )
647647 self .grid .place_agent (agent , (4 , 6 ))
648648
649649 empty_mask = self .grid .empty_mask
@@ -653,8 +653,8 @@ def test_get_empty_mask_with_agent(self):
653653 self .assertTrue (np .all (empty_mask == expected_mask ))
654654
655655 def test_get_neighborhood_mask (self ):
656- agent = MockAgent (0 , self . grid )
657- agent2 = MockAgent (1 , self . grid )
656+ agent = MockAgent (0 )
657+ agent2 = MockAgent (1 )
658658 self .grid .place_agent (agent , (5 , 5 ))
659659 self .grid .place_agent (agent2 , (5 , 6 ))
660660 neighborhood_mask = self .grid .get_neighborhood_mask ((5 , 5 ), True , False , 1 )
@@ -680,7 +680,7 @@ def condition(x):
680680 self .assertTrue (selected_mask .all ())
681681
682682 def test_move_agent_to_cell_by_properties (self ):
683- agent = MockAgent (1 , self . grid )
683+ agent = MockAgent (1 )
684684 self .grid .place_agent (agent , (5 , 5 ))
685685 conditions = {"layer1" : lambda x : x == 0 }
686686 target_cells = self .grid .select_cells (conditions )
@@ -689,7 +689,7 @@ def test_move_agent_to_cell_by_properties(self):
689689 self .assertNotEqual (agent .pos , (5 , 5 ))
690690
691691 def test_move_agent_no_eligible_cells (self ):
692- agent = MockAgent (3 , self . grid )
692+ agent = MockAgent (3 )
693693 self .grid .place_agent (agent , (5 , 5 ))
694694 conditions = {"layer1" : lambda x : x != 0 }
695695 target_cells = self .grid .select_cells (conditions )
@@ -711,7 +711,7 @@ def test_select_extreme_value_cells_return_mask(self):
711711 self .assertTrue (target_mask [3 , 1 ])
712712
713713 def test_move_agent_to_extreme_value_cell (self ):
714- agent = MockAgent (2 , self . grid )
714+ agent = MockAgent (2 )
715715 self .grid .place_agent (agent , (5 , 5 ))
716716 self .grid .properties ["layer2" ].set_cell ((3 , 1 ), 1.1 )
717717 target_cells = self .grid .select_cells (extreme_values = {"layer2" : "highest" })
@@ -721,7 +721,7 @@ def test_move_agent_to_extreme_value_cell(self):
721721 # Test using masks
722722 def test_select_cells_by_properties_with_empty_mask (self ):
723723 self .grid .place_agent (
724- MockAgent (0 , self . grid ), (5 , 5 )
724+ MockAgent (0 ), (5 , 5 )
725725 ) # Placing an agent to ensure some cells are not empty
726726 empty_mask = self .grid .empty_mask
727727
@@ -755,10 +755,10 @@ def condition(x):
755755 self .assertCountEqual (selected_cells , expected_selection )
756756
757757 def test_move_agent_to_cell_by_properties_with_empty_mask (self ):
758- agent = MockAgent (1 , self . grid )
758+ agent = MockAgent (1 )
759759 self .grid .place_agent (agent , (5 , 5 ))
760760 self .grid .place_agent (
761- MockAgent (2 , self . grid ), (4 , 5 )
761+ MockAgent (2 ), (4 , 5 )
762762 ) # Placing another agent to create a non-empty cell
763763 empty_mask = self .grid .empty_mask
764764 conditions = {"layer1" : lambda x : x == 0 }
@@ -769,7 +769,7 @@ def test_move_agent_to_cell_by_properties_with_empty_mask(self):
769769 ) # Agent should not move to (4, 5) as it's not empty
770770
771771 def test_move_agent_to_cell_by_properties_with_neighborhood_mask (self ):
772- agent = MockAgent (1 , self . grid )
772+ agent = MockAgent (1 )
773773 self .grid .place_agent (agent , (5 , 5 ))
774774 neighborhood_mask = self .grid .get_neighborhood_mask ((5 , 5 ), True , False , 1 )
775775 conditions = {"layer1" : lambda x : x == 0 }
@@ -789,7 +789,7 @@ def condition(x):
789789
790790 # Test if coordinates means the same between the grid and the property layer
791791 def test_property_layer_coordinates (self ):
792- agent = MockAgent (0 , self . grid )
792+ agent = MockAgent (0 )
793793 correct_pos = (1 , 8 )
794794 incorrect_pos = (8 , 1 )
795795 self .grid .place_agent (agent , correct_pos )
@@ -811,14 +811,14 @@ def test_property_layer_coordinates(self):
811811
812812 # Test selecting cells with only_empty parameter
813813 def test_select_cells_only_empty (self ):
814- self .grid .place_agent (MockAgent (0 , self . grid ), (5 , 5 )) # Occupying a cell
814+ self .grid .place_agent (MockAgent (0 ), (5 , 5 )) # Occupying a cell
815815 selected_cells = self .grid .select_cells (only_empty = True )
816816 self .assertNotIn (
817817 (5 , 5 ), selected_cells
818818 ) # The occupied cell should not be selected
819819
820820 def test_select_cells_only_empty_with_conditions (self ):
821- self .grid .place_agent (MockAgent (1 , self . grid ), (5 , 5 ))
821+ self .grid .place_agent (MockAgent (1 ), (5 , 5 ))
822822 self .grid .properties ["layer1" ].set_cell ((5 , 5 ), 2 )
823823 self .grid .properties ["layer1" ].set_cell ((6 , 6 ), 2 )
824824
@@ -855,7 +855,7 @@ def setUp(self):
855855 self .space = NetworkGrid (G )
856856 self .agents = []
857857 for i , pos in enumerate (TEST_AGENTS_NETWORK_SINGLE ):
858- a = MockAgent (i , None )
858+ a = MockAgent (i )
859859 self .agents .append (a )
860860 self .space .place_agent (a , pos )
861861
@@ -968,7 +968,7 @@ def setUp(self):
968968 self .space = NetworkGrid (G )
969969 self .agents = []
970970 for i , pos in enumerate (TEST_AGENTS_NETWORK_MULTIPLE ):
971- a = MockAgent (i , None )
971+ a = MockAgent (i )
972972 self .agents .append (a )
973973 self .space .place_agent (a , pos )
974974
0 commit comments