def test_can_use_context_manager_with_pin_exported_by_constructor(self): with exported(Pin(5, Pin.Out)) as p: assert p.is_exported p = Pin(5) assert not p.is_exported
def test_can_automatically_unexport_pin_with_context_manager(self): with exported(Pin(5)) as p: assert p.is_exported p = Pin(5) assert not p.is_exported
def test_can_use_context_manager_with_pin_exported_by_constructor(self): with exported(Pin(25, Pin.Out)) as p: assert p.is_exported p = Pin(25) assert not p.is_exported
def test_can_automatically_unexport_pin_with_context_manager(self): with exported(Pin(25)) as p: assert p.is_exported p = Pin(25) assert not p.is_exported
def test_can_use_context_manager_with_pin_exported_by_constructor(self): with exported(GPIOPin(0, Out)) as p: assert p.is_exported p = GPIOPin(0) assert not p.is_exported
def assert_output_seen_at_input(pin_type, op, ip): with exported(pin_type(op, direction=Out)) as output_pin, exported(pin_type(ip, direction=In)) as input_pin: for value in [1, 0, 1, 0]: output_pin.value = value assert input_pin.value == value print(op, "->", ip,": ok!")