def test_enable_pullup(self):
     m_input = ArduinoDigitalInput(self.INPUT_NAME, self.INPUT_PORT,
                                   self.INPUT_ADDRESS, self.mock_comm)
     comm = self.mock_comm
     comm.write_to_object = MagicMock(return_value=0)
     m_input.enable_pullup()
     comm.write_to_object.assert_called_with(self.INPUT_ADDRESS, 0x02, 0x01)
 def test_enable_pullup_when_enabled(self):
     m_input = ArduinoDigitalInput(self.INPUT_NAME, self.INPUT_PORT,
                                   self.INPUT_ADDRESS, self.mock_comm)
     comm = self.mock_comm
     comm.write_to_object = MagicMock(return_value=0)
     m_input.enable()
     comm.write_to_object.assert_called_with(self.INPUT_ADDRESS, 0x01, 0x01)
     self.assertTrue(m_input.is_enabled())
     self.assertRaises(AssertionError, lambda: m_input.enable_pullup())