def test_to_knx_invert(self): """Test to_knx function with normal operation.""" xknx = XKNX(loop=self.loop) remote_value = RemoteValueSwitch(xknx, invert=True) self.assertEqual(remote_value.to_knx(RemoteValueSwitch.Value.ON), DPTBinary(0)) self.assertEqual(remote_value.to_knx(RemoteValueSwitch.Value.OFF), DPTBinary(1))
def test_to_knx_error(self): """Test to_knx function with wrong parametern.""" xknx = XKNX(loop=self.loop) remote_value = RemoteValueSwitch(xknx) with self.assertRaises(ConversionError): remote_value.to_knx(1)
def test_to_knx_invert(self): """Test to_knx function with normal operation.""" xknx = XKNX(loop=self.loop) remote_value = RemoteValueSwitch(xknx, invert=True) self.assertEqual(remote_value.to_knx(True), DPTBinary(0)) self.assertEqual(remote_value.to_knx(False), DPTBinary(1))
def test_to_knx(self): """Test to_knx function with normal operation.""" xknx = XKNX(loop=self.loop) remote_value = RemoteValueSwitch(xknx) self.assertEqual(remote_value.to_knx(True), DPTBinary(True)) self.assertEqual(remote_value.to_knx(False), DPTBinary(False))