async def test_is_on(self): """Test is_on() and is_off() of a BinarySensor with state 'on'.""" xknx = XKNX() binaryinput = BinarySensor(xknx, "TestInput", "1/2/3") assert not binaryinput.is_on() assert binaryinput.is_off() await binaryinput._set_internal_state(True) assert binaryinput.is_on() assert not binaryinput.is_off()
def test_is_on(self): """Test is_on() and is_off() of a BinarySensor with state 'on'.""" xknx = XKNX() binaryinput = BinarySensor(xknx, "TestInput", "1/2/3") self.assertFalse(binaryinput.is_on()) self.assertTrue(binaryinput.is_off()) # pylint: disable=protected-access self.loop.run_until_complete(binaryinput._set_internal_state(True)) self.assertTrue(binaryinput.is_on()) self.assertFalse(binaryinput.is_off())
def test_is_off(self): """Test is_on() and is_off() of a BinarySensor with state 'off'.""" xknx = XKNX(loop=self.loop) binaryinput = BinarySensor(xknx, 'TestInput', '1/2/3') # pylint: disable=protected-access self.loop.run_until_complete(asyncio.Task(binaryinput._set_internal_state(BinarySensorState.OFF))) self.assertFalse(binaryinput.is_on()) self.assertTrue(binaryinput.is_off())