def test_to_knx_invert(self): """Test to_knx function with normal operation.""" xknx = XKNX(loop=self.loop) remote_value = RemoteValueUpDown(xknx, invert=True) self.assertEqual(remote_value.to_knx(RemoteValueUpDown.Direction.UP), DPTBinary(1)) self.assertEqual(remote_value.to_knx(RemoteValueUpDown.Direction.DOWN), DPTBinary(0))
def test_to_knx_error(self): """Test to_knx function with wrong parametern.""" xknx = XKNX(loop=self.loop) remote_value = RemoteValueUpDown(xknx) with self.assertRaises(ConversionError): remote_value.to_knx(1)