Example #1
0
 def test_unsigned_wrong_value_from_knx(self):
     """Test DPT4ByteUnsigned parsing with wrong value."""
     with pytest.raises(ConversionError):
         DPT4ByteUnsigned.from_knx((0xFF, 0x4E, 0x12))
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_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 #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