| 
				
			 | 
			
			
				@@ -1,9 +1,10 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				1
			 | 
			
			
				 # coding: utf-8 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				2
			 | 
			
			
				 # -*- coding: utf-8 -*- 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+from synergine2.config import Config 
			 | 
		
	
		
			
			| 
				3
			 | 
			
				4
			 | 
			
			
				 from synergine2.simulation import Subject 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				
			 | 
			
			
				-from synergine2.simulation import Subjects 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				
			 | 
			
			
				-from synergine2.simulation import Simulation 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				5
			 | 
			
			
				 from synergine2.xyz import ProximitySubjectMechanism 
			 | 
		
	
		
			
			| 
				
			 | 
			
				6
			 | 
			
			
				+from synergine2.xyz import XYZSubjects 
			 | 
		
	
		
			
			| 
				
			 | 
			
				7
			 | 
			
			
				+from synergine2.xyz import XYZSimulation 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				8
			 | 
			
			
				 from synergine2.xyz import XYZSubjectMixin 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				9
			 | 
			
			
				 from synergine2.xyz_utils import get_positions_from_str_representation 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				10
			 | 
			
			
				 from synergine2.xyz_utils import get_str_representation_from_positions 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -21,16 +22,17 @@ class MyProximityMechanism(ProximitySubjectMechanism): 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				22
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				22
			 | 
			
				23
			 | 
			
			
				 class TestXYZ(BaseTest): 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				24
			 | 
			
			
				     def test_proximity_mechanism_with_one(self): 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				
			 | 
			
			
				-        simulation = Simulation() 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				
			 | 
			
			
				-        subject = MySubject(simulation, position=(0, 0, 0)) 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-        other_subject = MySubject(simulation, position=(5, 0, 0)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+        simulation = XYZSimulation(Config()) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+        subject = MySubject(Config(), simulation, position=(0, 0, 0)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+        other_subject = MySubject(Config(), simulation, position=(5, 0, 0)) 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				28
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				28
			 | 
			
				
			 | 
			
			
				-        simulation.subjects = Subjects( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+        simulation.subjects = XYZSubjects( 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				30
			 | 
			
			
				             [subject, other_subject], 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				31
			 | 
			
			
				             simulation=simulation, 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				32
			 | 
			
			
				         ) 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				33
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				33
			 | 
			
				34
			 | 
			
			
				         proximity_mechanism = MyProximityMechanism( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+            config=Config(), 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				36
			 | 
			
			
				             simulation=simulation, 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				37
			 | 
			
			
				             subject=subject, 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				38
			 | 
			
			
				         ) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -46,16 +48,17 @@ class TestXYZ(BaseTest): 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				48
			 | 
			
			
				         }] == proximity_mechanism.run() 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				49
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				48
			 | 
			
				50
			 | 
			
			
				     def test_proximity_mechanism_excluding(self): 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				
			 | 
			
			
				-        simulation = Simulation() 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				
			 | 
			
			
				-        subject = MySubject(simulation, position=(0, 0, 0)) 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				
			 | 
			
			
				-        other_subject = MySubject(simulation, position=(11, 0, 0)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+        simulation = XYZSimulation(Config()) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+        subject = MySubject(Config(), simulation, position=(0, 0, 0)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+        other_subject = MySubject(Config(), simulation, position=(11, 0, 0)) 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				54
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				53
			 | 
			
				
			 | 
			
			
				-        simulation.subjects = Subjects( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				+        simulation.subjects = XYZSubjects( 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				56
			 | 
			
			
				             [subject, other_subject], 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				57
			 | 
			
			
				             simulation=simulation, 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				58
			 | 
			
			
				         ) 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				59
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				58
			 | 
			
				60
			 | 
			
			
				         proximity_mechanism = MyProximityMechanism( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+            config=Config(), 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				62
			 | 
			
			
				             simulation=simulation, 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				63
			 | 
			
			
				             subject=subject, 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				64
			 | 
			
			
				         ) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -68,17 +71,18 @@ class TestXYZ(BaseTest): 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				71
			 | 
			
			
				         assert [] == proximity_mechanism.run() 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				72
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				70
			 | 
			
				73
			 | 
			
			
				     def test_proximity_mechanism_with_multiple(self): 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				
			 | 
			
			
				-        simulation = Simulation() 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				-        subject = MySubject(simulation, position=(0, 0, 0)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				+        simulation = XYZSimulation(Config()) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				+        subject = MySubject(Config(), simulation, position=(0, 0, 0)) 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				76
			 | 
			
			
				         other_subjects = [] 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				77
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				75
			 | 
			
				78
			 | 
			
			
				         for i in range(3): 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				
			 | 
			
			
				-            other_subjects.append(MySubject(simulation, position=(i, i, 0))) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				79
			 | 
			
			
				+            other_subjects.append(MySubject(Config(), simulation, position=(i, i, 0))) 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				80
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				78
			 | 
			
				
			 | 
			
			
				-        simulation.subjects = Subjects([subject], simulation=simulation) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				+        simulation.subjects = XYZSubjects([subject], simulation=simulation) 
			 | 
		
	
		
			
			| 
				79
			 | 
			
				82
			 | 
			
			
				         simulation.subjects.extend(other_subjects) 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				83
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				81
			 | 
			
				84
			 | 
			
			
				         proximity_mechanism = MyProximityMechanism( 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+            config=Config(), 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				86
			 | 
			
			
				             simulation=simulation, 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				87
			 | 
			
			
				             subject=subject, 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				88
			 | 
			
			
				         ) 
			 |