class ServoHBridgeTestCase(HBridgeTestCase): def setUp(self): super(ServoHBridgeTestCase, self).setUp() self.driver = ServoHBridge(self.options, self.connection) def test_command_method_exists(self): """ Check that each command listed has a corresponding method on the driver class. """ for command in self.driver.commands: self.assertIn(command, dir(self.driver)) def test_turn_off(self): self.driver.turn_off() self.assertEqual(self.driver.state, 0) def test_rotate_clockwise(self): value = self.driver.rotate_clockwise() self.assertEqual(self.driver.state, 1) def test_rotate_counterclockwise(self): value = self.driver.rotate_counterclockwise() self.assertEqual(self.driver.state, -1)
def setUp(self): super(ServoHBridgeTestCase, self).setUp() self.driver = ServoHBridge(self.options, self.connection)