Example #1
0
 def test_to_knx(self):
     """Test to_knx function with normal operation."""
     xknx = XKNX()
     remote_value = RemoteValueColorXYY(xknx)
     assert remote_value.to_knx(((1, 0.9), 102)) == DPTArray(
         (0xFF, 0xFF, 0xE6, 0x66, 0x66, 0x03))
     assert remote_value.to_knx(((1, 0), 102)) == DPTArray(
         (0xFF, 0xFF, 0x00, 0x00, 0x66, 0x03))
Example #2
0
 def test_to_knx_error(self):
     """Test to_knx function with wrong parametern."""
     xknx = XKNX()
     remote_value = RemoteValueColorXYY(xknx)
     with pytest.raises(ConversionError):
         remote_value.to_knx(((2, 1), 1))
     with pytest.raises(ConversionError):
         remote_value.to_knx(((-1, 1), 2))
     with pytest.raises(ConversionError):
         remote_value.to_knx(((0.3, 0.5), 256))
     with pytest.raises(ConversionError):
         remote_value.to_knx((("0.4", 0), 102))
     with pytest.raises(ConversionError):
         remote_value.to_knx(((1, 1), "102"))
     with pytest.raises(ConversionError):
         remote_value.to_knx(((1, ), 1))