#NEWLINE# def test_move( self ) : #NEWLINE# #INDENT# angle_error_margin = ( ( MecDriver . max_angle - MecDriver . min_angle ) * 0.05 ) #NEWLINE# for test_speed in xrange ( ( MecDriver . min_speed + 1 ) , ( MecDriver . max_speed + 1 ) , 10 ) : #NEWLINE# #INDENT# for test_angle in xrange ( MecDriver . min_angle , ( MecDriver . max_angle + 1 ) , 10 ) : #NEWLINE# #INDENT# self . logger . debug ( 'Set speed  : {:3d}, angle: {:3d}' . format ( test_speed , test_angle ) ) #NEWLINE# self . md . move ( test_speed , test_angle ) #NEWLINE# self . logger . debug ( 'Check speed: {:3d}, angle: {:3d}' . format ( self . md . speed , self . md . angle ) ) #NEWLINE# '\n                Commented out due to normalizing ruining proportions.\n                Re-activate if we ever remove that.\n                # Check for approximate match, floats will seldom be exact\n                assert fabs(self.md.speed - test_speed) < speed_error_margin\n                ' #NEWLINE# if ( fabs ( position ) >= 10 ) : #NEWLINE# #INDENT# assert ( ( fabs ( ( self . md . angle - test_angle ) ) % 360 ) < angle_error_margin ) #NEWLINE# #UNINDENT# if ( test_angle == 0 ) : #NEWLINE# #INDENT# for ( position , motor ) in self . md . motors . iteritems ( ) : #NEWLINE# #INDENT# self . logger . debug ( ( 'Ahmed Motor: {}, Speed: {}, Motor_speed:' + '{}, Angle: {}, Direction: {}' . format ( position , test_speed , motor . speed , test_angle , motor . direction ) ) ) #NEWLINE# assert ( motor . direction == 'forward' ) #NEWLINE# #UNINDENT# #UNINDENT# for motor in self . md . motors . itervalues ( ) : #NEWLINE# #INDENT# assert ( MecDriver . min_speed <= motor . speed <= MecDriver . max_speed )