Example #1
0
 def test_to_knx_wrong_minutes(self):
     """Test parsing from DPTTime object from wrong minutes value."""
     with self.assertRaises(ConversionError):
         DPTTime().to_knx({'hours': 12, 'minutes': 61, 'seconds': 53})
Example #2
0
 def test_test_range_wrong_weekday(self):
     """Test range testing with wrong weekday (Cant be tested with normal from_/to_knx)."""
     # pylint: disable=protected-access
     self.assertFalse(DPTTime._test_range(8, 0, 0, 0))
Example #3
0
 def test_to_knx_wrong_parameter(self):
     with self.assertRaises(ConversionError):
         DPTTime().to_knx("fnord")
Example #4
0
 def test_to_knx_wrong_parameter(self):
     """Test parsing from DPTTime object from wrong string value."""
     with self.assertRaises(ConversionError):
         DPTTime().to_knx("fnord")
Example #5
0
 def test_from_knx_wrong_parameter2(self):
     with self.assertRaises(ConversionError):
         DPTTime().from_knx((0xF8, "0x23"))
Example #6
0
 def test_to_knx_default(self):
     self.assertEqual(DPTTime().to_knx({}), (0x0, 0x0, 0x0))
Example #7
0
 def test_from_knx_wrong_parameter2(self):
     """Test parsing from DPTTime object from wrong binary values."""
     with self.assertRaises(ConversionError):
         DPTTime().from_knx((0xF8, "0x23"))
Example #8
0
 def test_to_knx_default(self):
     """Testing default initialization of DPTTime object."""
     self.assertEqual(DPTTime().to_knx({}), (0x0, 0x0, 0x0))
Example #9
0
 def broadcast_time(self):
     telegram = Telegram()
     telegram.group_address = self.group_address
     telegram.payload = DPTArray(DPTTime.current_time_as_knx())
     self.xknx.telegrams.put_nowait(telegram)