'Testing whether the encoding of an error packet is correct'

def test_encode_packet_error(self):

    encoded = encode_packet({'opcode': OPCODE_ERROR, 'session_id': 123, 'error_code': 1, 'error_msg': 'hi'})
    self.assertEqual(encoded[(-3)], 'h')
    self.assertEqual(encoded[(-2)], 'i')
