Exemplo n.º 1
0
 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))
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)