# 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 r.get('b') == b('b1')
            assert await r.get('c') == b('c1')

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline_no_transaction_watch(self, r):
        await r.flushdb()
        await r.set('a', 0)

        async with await r.pipeline(transaction=False) as pipe:
            await pipe.watch('a')
            a = await pipe.get('a')

            pipe.multi()
            await pipe.set('a', int(a) + 1)
            assert await pipe.execute() == [True]

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline_no_transaction_watch_failure(self, r):
        await r.flushdb()
        await r.set('a', 0)

        async with await r.pipeline(transaction=False) as pipe:
            await pipe.watch('a')
            a = await pipe.get('a')

            await r.set('a', 'bad')

            pipe.multi()
            await pipe.set('a', int(a) + 1)


# 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 r.get('b') == b('b1')
            assert await r.get('c') == b('c1')

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline_no_transaction_watch(self, r):
        await r.flushdb()
        await r.set('a', 0)

        async with await r.pipeline(transaction=False) as pipe:
            await pipe.watch('a')
            a = await pipe.get('a')

            pipe.multi()
            await pipe.set('a', int(a) + 1)
            assert await pipe.execute() == [True]

    @pytest.mark.asyncio(forbid_global_loop=True)
    async def test_pipeline_no_transaction_watch_failure(self, r):
        await r.flushdb()
        await r.set('a', 0)

        async with await r.pipeline(transaction=False) as pipe:
            await pipe.watch('a')
            a = await pipe.get('a')

            await r.set('a', 'bad')

            pipe.multi()
            await pipe.set('a', int(a) + 1)


            with pytest.raises(WatchError):