async def send_command(self, command_name): self.writer.write(encode_command(command_name)) await self.writer.drain()
def test_encode_mute_toggle(self): self.assertEqual(encode_command('MUTE_TOGGLE'), b'\xfe\x03\xa3\x10\x1e\xd4')
def test_encode_power_toggle(self): self.assertEqual(encode_command('POWER_TOGGLE'), b'\xfe\x03\xa3\x10\x0a\xc0')
def test_make_invalid_command(self): with self.assertRaises(KeyError): encode_command('INVALID_COMMAND')
def test_meta_encoding_of_start_byte(self): self.assertEqual(encode_command('ZONE_3_VOLUME_36'), b'\xfe\x03\xa3\x33\x24\xfd\x00')
def test_meta_encoding_of_escape_byte(self): self.assertEqual(encode_command('VOLUME_40'), b'\xfe\x03\xa3\x30\x28\xfd\x01')