@ -1,7 +1,10 @@ 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					#!/usr/bin/env python3  
					 
					 
					 
					#!/usr/bin/env python3  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					from  cereal  import  car  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					import  unittest  
					 
					 
					 
					import  unittest  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					from  selfdrive . car . toyota . values  import  DBC ,  TSS2_CAR ,  ANGLE_CONTROL_CAR  
					 
					 
					 
					from  selfdrive . car . toyota . values  import  CAR ,  DBC ,  TSS2_CAR ,  ANGLE_CONTROL_CAR ,  FW_VERSIONS  
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					Ecu  =  car . CarParams . Ecu  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					class  TestToyotaInterfaces ( unittest . TestCase ) :  
					 
					 
					 
					class  TestToyotaInterfaces ( unittest . TestCase ) :  
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -11,10 +14,29 @@ class TestToyotaInterfaces(unittest.TestCase): 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  def  test_tss2_dbc ( self ) :   
					 
					 
					 
					  def  test_tss2_dbc ( self ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    # We make some assumptions about TSS2 platforms,   
					 
					 
					 
					    # We make some assumptions about TSS2 platforms,   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    # like looking up certain signals only in this DBC   
					 
					 
					 
					    # like looking up certain signals only in this DBC   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    for  car ,  dbc  in  DBC . items ( ) :   
					 
					 
					 
					    for  car_model  ,  dbc  in  DBC . items ( ) :   
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					      if  car  in  TSS2_CAR :   
					 
					 
					 
					      if  car_model   in  TSS2_CAR :   
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					        self . assertEqual ( dbc [ " pt " ] ,  " toyota_nodsu_pt_generated " )   
					 
					 
					 
					        self . assertEqual ( dbc [ " pt " ] ,  " toyota_nodsu_pt_generated " )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  def  test_essential_ecus ( self ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    # Asserts standard ECUs exist for each platform   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    common_ecus  =  { Ecu . fwdRadar ,  Ecu . fwdCamera }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    for  car_model ,  ecus  in  FW_VERSIONS . items ( ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      with  self . subTest ( car_model = car_model ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        present_ecus  =  { ecu [ 0 ]  for  ecu  in  ecus }   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        missing_ecus  =  common_ecus  -  present_ecus   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        self . assertEqual ( len ( missing_ecus ) ,  0 )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        # Some exceptions for other common ECUs   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        if  car_model  not  in  ( CAR . ALPHARD_TSS2 , ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          self . assertIn ( Ecu . abs ,  present_ecus )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        if  car_model  not  in  ( CAR . MIRAI , ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          self . assertIn ( Ecu . engine ,  present_ecus )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					        if  car_model  not  in  ( CAR . PRIUS_V ,  CAR . LEXUS_CTH ) :   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					          self . assertIn ( Ecu . eps ,  present_ecus )   
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					if  __name__  ==  " __main__ " :  
					 
					 
					 
					if  __name__  ==  " __main__ " :  
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  unittest . main ( )   
					 
					 
					 
					  unittest . main ( )