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


import pytest
from aredis.utils import b
from aredis.exceptions import (WatchError,
                               ResponseError)
from __future__ import with_statement



class TestPipeline:

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline(self, r):
        await r.flushdb()
        async with await r.pipeline() as pipe:
            await pipe.set('a', 'a1')
            await pipe.get('a')
            await pipe.zadd('z', z1=1)
            await pipe.zadd('z', z2=4)
            await pipe.zincrby('z', 'z1')
            await pipe.zrange('z', 0, 5, withscores=True)
            assert await pipe.execute() == \
                [
                    True,

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


# Path: tests/client/test_pipeline.py
import pytest
from aredis.utils import b
from aredis.exceptions import (WatchError,
                               ResponseError)

from __future__ import with_statement



class TestPipeline:

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline(self, r):
        await r.flushdb()
        async with await r.pipeline() as pipe:
            await pipe.set('a', 'a1')
            await pipe.get('a')
            await pipe.zadd('z', z1=1)
            await pipe.zadd('z', z2=4)
            await pipe.zincrby('z', 'z1')
            await pipe.zrange('z', 0, 5, withscores=True)
            assert await pipe.execute() == \
                [
                    True,

                    b('a1'),