def test_set_tw_unsupported(self): """Test setting the tunable white value of a non tw Light.""" # pylint: disable=invalid-name xknx = XKNX() light = Light(xknx, name="TestLight", group_address_switch="1/2/3") with patch("logging.Logger.warning") as mock_warn: self.loop.run_until_complete(light.set_tunable_white(23)) self.assertEqual(xknx.telegrams.qsize(), 0) mock_warn.assert_called_with( "Tunable white not supported for device %s", "TestLight")
def test_set_tw(self): """Test setting the tunable white value of a Light.""" xknx = XKNX(loop=self.loop) light = Light(xknx, name="TestLight", group_address_switch='1/2/3', group_address_tunable_white='1/2/5') self.loop.run_until_complete(asyncio.Task(light.set_tunable_white(23))) self.assertEqual(xknx.telegrams.qsize(), 1) telegram = xknx.telegrams.get_nowait() self.assertEqual(telegram, Telegram(GroupAddress('1/2/5'), payload=DPTArray(23)))