| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -14,43 +14,43 @@ def patched_controller(controller_class): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					class TestFanController(unittest.TestCase): | 
					 | 
					 | 
					 | 
					class TestFanController(unittest.TestCase): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def wind_up(self, controller, ignition=True): | 
					 | 
					 | 
					 | 
					  def wind_up(self, controller, ignition=True): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for _ in range(1000): | 
					 | 
					 | 
					 | 
					    for _ in range(1000): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      controller.update(max_cpu_temp=100, ignition=ignition) | 
					 | 
					 | 
					 | 
					      controller.update(100, ignition) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def wind_down(self, controller, ignition=False): | 
					 | 
					 | 
					 | 
					  def wind_down(self, controller, ignition=False): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for _ in range(1000): | 
					 | 
					 | 
					 | 
					    for _ in range(1000): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      controller.update(max_cpu_temp=10, ignition=ignition) | 
					 | 
					 | 
					 | 
					      controller.update(10, ignition) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def test_hot_onroad(self, controller_class): | 
					 | 
					 | 
					 | 
					  def test_hot_onroad(self, controller_class): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.wind_up(controller) | 
					 | 
					 | 
					 | 
					    self.wind_up(controller) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.assertGreaterEqual(controller.update(max_cpu_temp=100, ignition=True), 70) | 
					 | 
					 | 
					 | 
					    self.assertGreaterEqual(controller.update(100, True), 70) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def test_offroad_limits(self, controller_class): | 
					 | 
					 | 
					 | 
					  def test_offroad_limits(self, controller_class): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.wind_up(controller) | 
					 | 
					 | 
					 | 
					    self.wind_up(controller) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.assertLessEqual(controller.update(max_cpu_temp=100, ignition=False), 30) | 
					 | 
					 | 
					 | 
					    self.assertLessEqual(controller.update(100, False), 30) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def test_no_fan_wear(self, controller_class): | 
					 | 
					 | 
					 | 
					  def test_no_fan_wear(self, controller_class): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.wind_down(controller) | 
					 | 
					 | 
					 | 
					    self.wind_down(controller) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.assertEqual(controller.update(max_cpu_temp=10, ignition=False), 0) | 
					 | 
					 | 
					 | 
					    self.assertEqual(controller.update(10, False), 0) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def test_limited(self, controller_class): | 
					 | 
					 | 
					 | 
					  def test_limited(self, controller_class): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.wind_up(controller, ignition=True) | 
					 | 
					 | 
					 | 
					    self.wind_up(controller, True) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.assertGreaterEqual(controller.update(max_cpu_temp=100, ignition=True), 80) | 
					 | 
					 | 
					 | 
					    self.assertEqual(controller.update(100, True), 100) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
					 | 
					 | 
					 | 
					  @parameterized.expand(ALL_CONTROLLERS) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  def test_windup_speed(self, controller_class): | 
					 | 
					 | 
					 | 
					  def test_windup_speed(self, controller_class): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
					 | 
					 | 
					 | 
					    controller = patched_controller(controller_class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.wind_down(controller, ignition=True) | 
					 | 
					 | 
					 | 
					    self.wind_down(controller, True) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for _ in range(10): | 
					 | 
					 | 
					 | 
					    for _ in range(10): | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      controller.update(max_cpu_temp=90, ignition=True) | 
					 | 
					 | 
					 | 
					      controller.update(90, True) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    self.assertGreaterEqual(controller.update(max_cpu_temp=90, ignition=True), 60) | 
					 | 
					 | 
					 | 
					    self.assertGreaterEqual(controller.update(90, True), 60) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					if __name__ == "__main__": | 
					 | 
					 | 
					 | 
					if __name__ == "__main__": | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  unittest.main() | 
					 | 
					 | 
					 | 
					  unittest.main() | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |