We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 67c976f commit 1cc27b2Copy full SHA for 1cc27b2
test/motors.py
@@ -58,5 +58,14 @@ def test_pwm(self):
58
self.assertRaises(MotorException, m.pwm, -2)
59
self.assertRaises(MotorException, m.pwm, 2)
60
61
+ def test_callback(self):
62
+ m = Motor('A')
63
+ def handle_motor(speed, pos, apos):
64
+ handle_motor.evt += 1
65
+ handle_motor.evt = 0
66
+ m.when_rotated = handle_motor
67
+ m.run_for_seconds(1)
68
+ self.assertGreater(handle_motor.evt, 0)
69
+
70
if __name__ == '__main__':
71
unittest.main()
0 commit comments