# Path: aredis/exceptions.py
# class RedisClusterException(Exception):
#     pass
# 
# class NoScriptError(ResponseError):
#     pass
# 
# class ResponseError(RedisError):
#     pass
# 
# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x


import asyncio
import pytest
from aredis.exceptions import RedisClusterException, NoScriptError, ResponseError
from aredis.utils import b
        await pipe.set('a', 2)
        await pipe.get('a')
        assert multiply.sha
        multiply(keys=['a'], args=[3], client=pipe)
        assert await r.script_exists(multiply.sha) == [False]
        # [SET worked, GET 'a', result of multiple script]
        assert await pipe.execute() == [True, b('2'), 6]

    @pytest.mark.asyncio(forbid_global_loop=True)
    @pytest.mark.xfail(reason="Not Yet Implemented")
    async def test_eval_msgpack_pipeline_error_in_lua(self, r):
        msgpack_hello = await r.register_script(msgpack_hello_script)
        assert not msgpack_hello.sha

        pipe = r.pipeline()

        # avoiding a dependency to msgpack, this is the output of
        # msgpack.dumps({"name": "joe"})
        msgpack_message_1 = b'\x81\xa4name\xa3Joe'

        msgpack_hello(args=[msgpack_message_1], client=pipe)

        assert await r.script_exists(msgpack_hello.sha) == [True]
        assert await pipe.execute()[0] == b'hello Joe'

        msgpack_hello_broken = await r.register_script(msgpack_hello_script_broken)

        msgpack_hello_broken(args=[msgpack_message_1], client=pipe)
        with pytest.raises(ResponseError) as excinfo:
            await pipe.execute()

# Path: aredis/exceptions.py
# class RedisClusterException(Exception):
#     pass
# 
# class NoScriptError(ResponseError):
#     pass
# 
# class ResponseError(RedisError):
#     pass
# 
# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x


# Path: tests/cluster/test_scripting.py
import asyncio
import pytest
from aredis.exceptions import RedisClusterException, NoScriptError, ResponseError
from aredis.utils import b

        await pipe.set('a', 2)
        await pipe.get('a')
        assert multiply.sha
        multiply(keys=['a'], args=[3], client=pipe)
        assert await r.script_exists(multiply.sha) == [False]
        # [SET worked, GET 'a', result of multiple script]
        assert await pipe.execute() == [True, b('2'), 6]

    @pytest.mark.asyncio(forbid_global_loop=True)
    @pytest.mark.xfail(reason="Not Yet Implemented")
    async def test_eval_msgpack_pipeline_error_in_lua(self, r):
        msgpack_hello = await r.register_script(msgpack_hello_script)
        assert not msgpack_hello.sha

        pipe = r.pipeline()

        # avoiding a dependency to msgpack, this is the output of
        # msgpack.dumps({"name": "joe"})
        msgpack_message_1 = b'\x81\xa4name\xa3Joe'

        msgpack_hello(args=[msgpack_message_1], client=pipe)

        assert await r.script_exists(msgpack_hello.sha) == [True]
        assert await pipe.execute()[0] == b'hello Joe'

        msgpack_hello_broken = await r.register_script(msgpack_hello_script_broken)

        msgpack_hello_broken(args=[msgpack_message_1], client=pipe)
        with pytest.raises(ResponseError) as excinfo:
            await pipe.execute()

        assert excinfo.type == ResponseError