# 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)
            assert await pipe.execute() == \
                [
                    True,
                    b('a1'),
                    1,
                    1,
                    2.0,
                    [(b('z1'), 2.0), (b('z2'), 4)],
                ]

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline_length(self, r):
        await r.flushdb()
        async with await r.pipeline() as pipe:
            # Initially empty.
            assert len(pipe) == 0
            assert not pipe

            # Fill 'er up!
            await pipe.set('a', 'a1')
            await pipe.set('b', 'b1')
            await pipe.set('c', 'c1')
            assert len(pipe) == 3
            assert pipe

            # Execute calls reset(), so empty once again.
            await pipe.execute()
            assert len(pipe) == 0
            assert not pipe


# 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)

            assert await pipe.execute() == \
                [
                    True,
                    b('a1'),
                    1,
                    1,
                    2.0,
                    [(b('z1'), 2.0), (b('z2'), 4)],
                ]

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline_length(self, r):
        await r.flushdb()
        async with await r.pipeline() as pipe:
            # Initially empty.
            assert len(pipe) == 0
            assert not pipe

            # Fill 'er up!
            await pipe.set('a', 'a1')
            await pipe.set('b', 'b1')
            await pipe.set('c', 'c1')
            assert len(pipe) == 3
            assert pipe

            # Execute calls reset(), so empty once again.
            await pipe.execute()
            assert len(pipe) == 0
            assert not pipe


    @pytest.mark.asyncio(forbid_global_loop=True)