class InputPinTests(unittest.TestCase): """InputPin tests""" def setUp(self): self.callback = Mock() self.pin = InputPin(pin=16, value=0, callback=self.callback) def test_exists(self): assert isinstance(self.pin, InputPin) def test_pin_assignment(self): assert_equals(self.pin._pin, 16) def test_pin_value(self): assert_equals(self.pin.value, 0) def test_trigger(self): self.pin.trigger(1) self.callback.assert_called_with(1)
def setUp(self): self.callback = Mock() self.pin = InputPin(pin=16, value=0, callback=self.callback)