コード例 #1
0
 def test_process(self):
     """Test process telegram."""
     xknx = XKNX()
     remote_value = RemoteValueString(xknx,
                                      group_address=GroupAddress("1/2/3"))
     telegram = Telegram(
         group_address=GroupAddress("1/2/3"),
         payload=DPTArray((
             0x41,
             0x41,
             0x41,
             0x41,
             0x41,
             0x42,
             0x42,
             0x42,
             0x42,
             0x42,
             0x43,
             0x43,
             0x43,
             0x43,
         )),
     )
     self.loop.run_until_complete(remote_value.process(telegram))
     self.assertEqual(remote_value.value, "AAAAABBBBBCCCC")
コード例 #2
0
 def test_to_process_error(self):
     """Test process errornous telegram."""
     xknx = XKNX()
     remote_value = RemoteValueString(xknx,
                                      group_address=GroupAddress("1/2/3"))
     with self.assertRaises(CouldNotParseTelegram):
         telegram = Telegram(group_address=GroupAddress("1/2/3"),
                             payload=DPTBinary(1))
         self.loop.run_until_complete(remote_value.process(telegram))
     with self.assertRaises(CouldNotParseTelegram):
         telegram = Telegram(
             group_address=GroupAddress("1/2/3"),
             payload=DPTArray((
                 0x64,
                 0x65,
             )),
         )
         self.loop.run_until_complete(remote_value.process(telegram))