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