示例#1
0
 def test_to_knx_wrong_parameter(self):
     """Test parsing from DPTDate object from wrong string value."""
     with pytest.raises(ConversionError):
         DPTDate.to_knx("hello")
示例#2
0
 def test_to_knx_old_date(self):
     """Testing KNX/Byte representation of DPTDate object. Example 2."""
     raw = DPTDate.to_knx(time.strptime("1990-01-31", "%Y-%m-%d"))
     assert raw == (0x1F, 0x01, 0x5A)
示例#3
0
 def test_to_knx_future_date(self):
     """Testing KNX/Byte representation of DPTDate object. Example 3."""
     raw = DPTDate.to_knx(time.strptime("2089-12-04", "%Y-%m-%d"))
     assert raw == (0x04, 0x0C, 0x59)
示例#4
0
 def test_to_knx(self):
     """Testing KNX/Byte representation of DPTDate object. Example 1."""
     raw = DPTDate.to_knx(time.strptime("2002-1-04", "%Y-%m-%d"))
     assert raw == (0x04, 0x01, 0x02)