Example #1
0
 def test_unsigned_value_01234567(self):
     """Test DPT4ByteUnsigned parsing and streaming."""
     assert DPT4ByteUnsigned.to_knx(19088743) == (0x01, 0x23, 0x45, 0x67)
     assert DPT4ByteUnsigned.from_knx((0x01, 0x23, 0x45, 0x67)) == 19088743
Example #2
0
 def test_unsigned_value_min_value(self):
     """Test parsing and streaming with null values."""
     assert DPT4ByteUnsigned.to_knx(0) == (0x00, 0x00, 0x00, 0x00)
     assert DPT4ByteUnsigned.from_knx((0x00, 0x00, 0x00, 0x00)) == 0
Example #3
0
 def test_unsigned_to_knx_exceed_limits(self):
     """Test initialization of DPT4ByteUnsigned with wrong value (Overflow)."""
     with pytest.raises(ConversionError):
         DPT4ByteUnsigned.to_knx(4294967296)
Example #4
0
 def test_unsigned_value_max_value(self):
     """Test DPT4ByteUnsigned parsing and streaming."""
     assert DPT4ByteUnsigned.to_knx(4294967295) == (0xFF, 0xFF, 0xFF, 0xFF)
     assert DPT4ByteUnsigned.from_knx(
         (0xFF, 0xFF, 0xFF, 0xFF)) == 4294967295
Example #5
0
 def test_unsigned_assert_min_exceeded(self):
     """Test initialization of DPT4ByteUnsigned with wrong value (Underflow)."""
     with pytest.raises(ConversionError):
         DPT4ByteUnsigned.to_knx(-1)