Example #1
0
 def test_to_knx_wrong_parameter(self):
     """Test parsing from DPTTime object from wrong string value."""
     with pytest.raises(ConversionError):
         DPTTime.to_knx("fnord")
Example #2
0
 def test_to_knx_default(self):
     """Testing default initialization of DPTTime object."""
     assert DPTTime.to_knx(time.strptime("", "")) == (0x0, 0x0, 0x0)
Example #3
0
 def test_to_knx_max(self):
     """Testing KNX/Byte representation of DPTTime object. Maximum values."""
     raw = DPTTime.to_knx(time.strptime("23 59 59 0", "%H %M %S %w"))
     assert raw == (0xF7, 0x3B, 0x3B)
Example #4
0
 def test_to_knx_min(self):
     """Testing KNX/Byte representation of DPTTime object. Minimum values."""
     raw = DPTTime.to_knx(time.strptime("0 0 0", "%H %M %S"))
     assert raw == (0x0, 0x0, 0x0)
Example #5
0
 def test_to_knx(self):
     """Testing KNX/Byte representation of DPTTime object."""
     raw = DPTTime.to_knx(time.strptime("13 23 42 2", "%H %M %S %w"))
     assert raw == (0x4D, 0x17, 0x2A)