def test_to_knx_error(self):
     """Test to_knx function with wrong parametern."""
     xknx = XKNX()
     remote_value = RemoteValueSwitch(xknx)
     with pytest.raises(ConversionError):
         remote_value.to_knx(1)
 def test_to_knx_invert(self):
     """Test to_knx function with normal operation."""
     xknx = XKNX()
     remote_value = RemoteValueSwitch(xknx, invert=True)
     assert remote_value.to_knx(True) == DPTBinary(0)
     assert remote_value.to_knx(False) == DPTBinary(1)
示例#3
0
 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))
示例#4
0
 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)
示例#5
0
 def test_to_knx(self):
     """Test to_knx function with normal operation."""
     xknx = XKNX()
     remote_value = RemoteValueSwitch(xknx)
     self.assertEqual(remote_value.to_knx(True), DPTBinary(True))
     self.assertEqual(remote_value.to_knx(False), DPTBinary(False))