#NEWLINE# def test_manually_confirm( self ) : #NEWLINE# #INDENT# 'Test a series of random speeds, read the simulated HW to confirm.' #NEWLINE# for i in range ( 10 ) : #NEWLINE# #INDENT# test_speed = randint ( 0 , 100 ) #NEWLINE# self . motor . speed = test_speed #NEWLINE# cur_pwm = self . get_pwm ( self . pwm_num ) #NEWLINE# duty = int ( cur_pwm [ 'duty_ns' ] ) #NEWLINE# period = int ( duty [ 'period_ns' ] ) #NEWLINE# speed = int ( round ( ( ( duty / float ( period ) ) * 100 ) ) ) #NEWLINE# assert ( speed == test_speed ) , '{} != {}' . format ( speed , test_speed )