Exemplo n.º 1
0
 def test_current_value_78(self):
     """Test DPTUElCurrentmA parsing and streaming 78mA."""
     assert DPTUElCurrentmA.to_knx(78) == (0x00, 0x4E)
     assert DPTUElCurrentmA.from_knx((0x00, 0x4E)) == 78
Exemplo n.º 2
0
 def test_current_value_1234(self):
     """Test DPTUElCurrentmA parsing and streaming 4660mA."""
     assert DPTUElCurrentmA.to_knx(4660) == (0x12, 0x34)
     assert DPTUElCurrentmA.from_knx((0x12, 0x34)) == 4660
Exemplo n.º 3
0
 def test_current_value_38(self):
     """Test DPTUElCurrentmA parsing and streaming 38mA."""
     assert DPTUElCurrentmA.to_knx(38) == (0x00, 0x26)
     assert DPTUElCurrentmA.from_knx((0x00, 0x26)) == 38
Exemplo n.º 4
0
 def test_current_value_min_value(self):
     """Test DPTUElCurrentmA parsing and streaming with null values."""
     assert DPTUElCurrentmA.to_knx(0) == (0x00, 0x00)
     assert DPTUElCurrentmA.from_knx((0x00, 0x00)) == 0
Exemplo n.º 5
0
 def test_current_value_max_value(self):
     """Test DPTUElCurrentmA parsing and streaming."""
     assert DPTUElCurrentmA.to_knx(65535) == (0xFF, 0xFF)
     assert DPTUElCurrentmA.from_knx((0xFF, 0xFF)) == 65535
Exemplo n.º 6
0
 def test_current_to_knx_exceed_limits(self):
     """Test initialization of DPTUElCurrentmA with wrong value (Overflow)."""
     with pytest.raises(ConversionError):
         DPTUElCurrentmA.to_knx(65536)
Exemplo n.º 7
0
 def test_current_assert_min_exceeded(self):
     """Test initialization of DPTUElCurrentmA with wrong value (Underflow)."""
     with pytest.raises(ConversionError):
         DPTUElCurrentmA.to_knx(-1)