示例#1
0
 def test_construct_non_standard_length(self):
     driver = UnipiDALIDriver()
     mock_command = mock.MagicMock(spec=Command)
     mock_frame = mock.MagicMock(spec=ForwardFrame)
     mock_frame.__len__.return_value = 1
     with self.assertRaises(ValueError):
         driver.construct(mock_command)
示例#2
0
 def test_construct_length_24_config(self):
     driver = UnipiDALIDriver()
     mock_command = mock.MagicMock(spec=Command)
     mock_frame = mock.MagicMock(spec=ForwardFrame)
     mock_frame.__len__.return_value = 24
     mock_frame.as_byte_sequence = (1, 2, 3)
     mock_command.frame = mock_frame
     mock_command.sendtwice = True
     self.assertEqual(driver.construct(mock_command), (2817, 515))
示例#3
0
 def test_construct_length_16_config(self):
     driver = UnipiDALIDriver()
     command = Reset(Short(1))
     self.assertEqual(driver.construct(command), (2560, 800))
示例#4
0
 def test_construct_length_16(self):
     driver = UnipiDALIDriver()
     command = DAPC(Short(1), 2)
     self.assertEqual(driver.construct(command), (512, 514))