# Path: aredis/exceptions.py
# class RedisClusterException(Exception):
#     pass
# 
# class ResponseError(RedisError):
#     pass
# 
# class DataError(RedisError):
#     pass
# 
# class RedisError(Exception):
#     pass
# 
# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x
# 
# def iteritems(x):
#     return iter(x.items())
# 
# def iterkeys(x):
#     return iter(x.keys())
# 
# def itervalues(x):
#     return iter(x.values())
# 
# Path: aredis/commands/server.py
# def parse_info(response):
#     """Parses the result of Redis's INFO command into a Python dict"""
#     info = {}
#     response = nativestr(response)
# 
#     def get_value(value):
#         if ',' not in value or '=' not in value:
#             try:
#                 if '.' in value:
#                     return float(value)
#                 else:
#                     return int(value)
#             except ValueError:
#                 return value
#         else:
#             sub_dict = {}
#             for item in value.split(','):
#                 k, v = item.rsplit('=', 1)
#                 sub_dict[k] = get_value(v)
#             return sub_dict
# 
#     for line in response.splitlines():
#         if line and not line.startswith('#'):
#             if line.find(':') != -1:
#                 key, value = line.split(':', 1)
#                 info[key] = get_value(value)
#             else:
#                 # if the line isn't splittable, append it to the "__raw__" key
#                 info.setdefault('__raw__', []).append(line)
# 
#     return info
# 
# Path: tests/cluster/conftest.py
# def skip_if_server_version_lt(min_version):
#     """
#     """
#     versions = get_versions()
#     for version in versions.values():
#         if StrictVersion(version) < StrictVersion(min_version):
#             return pytest.mark.skipif(True, reason="")
#     return pytest.mark.skipif(False, reason="")
# 
# def skip_if_redis_py_version_lt(min_version):
#     """
#     """
#     import aredis
#     version = aredis.__version__
#     if StrictVersion(version) < StrictVersion(min_version):
#         return pytest.mark.skipif(True, reason="")
#     return pytest.mark.skipif(False, reason="")


import datetime
import re
import time
import pytest
from string import ascii_letters
from aredis.exceptions import RedisClusterException, ResponseError, DataError, RedisError
from aredis.utils import b, iteritems, iterkeys, itervalues
from aredis.commands.server import parse_info
from tests.cluster.conftest import skip_if_server_version_lt, skip_if_redis_py_version_lt
        assert await r.get('a') == b('1')
        assert await r.incrbyfloat('a', 1.1) == 2.1
        assert float(await r.get('a')) == float(2.1)

    @pytest.mark.asyncio
    async def test_keys(self, r):
        await r.flushdb()
        keys = await r.keys()
        assert keys == []
        keys_with_underscores = set(['test_a', 'test_b'])
        keys = keys_with_underscores.union(set(['testc']))
        for key in keys:
            await r.set(key, 1)
        assert set(await r.keys(pattern='test_*')) == {b(k) for k in keys_with_underscores}
        assert set(await r.keys(pattern='test*')) == {b(k) for k in keys}

    @pytest.mark.asyncio
    async def test_mget(self, r):
        await r.flushdb()
        assert await r.mget(['a', 'b']) == [None, None]
        await r.set('a', 1)
        await r.set('b', 2)
        await r.set('c', 3)
        assert await r.mget('a', 'other', 'b', 'c') == [b('1'), None, b('2'), b('3')]

    @pytest.mark.asyncio
    async def test_mset(self, r):
        await r.flushdb()
        d = {'a': b('1'), 'b': b('2'), 'c': b('3')}
        assert await r.mset(d)

# Path: aredis/exceptions.py
# class RedisClusterException(Exception):
#     pass
# 
# class ResponseError(RedisError):
#     pass
# 
# class DataError(RedisError):
#     pass
# 
# class RedisError(Exception):
#     pass
# 
# Path: aredis/utils.py
# def b(x):
#     return x.encode('latin-1') if not isinstance(x, bytes) else x
# 
# def iteritems(x):
#     return iter(x.items())
# 
# def iterkeys(x):
#     return iter(x.keys())
# 
# def itervalues(x):
#     return iter(x.values())
# 
# Path: aredis/commands/server.py
# def parse_info(response):
#     """Parses the result of Redis's INFO command into a Python dict"""
#     info = {}
#     response = nativestr(response)
# 
#     def get_value(value):
#         if ',' not in value or '=' not in value:
#             try:
#                 if '.' in value:
#                     return float(value)
#                 else:
#                     return int(value)
#             except ValueError:
#                 return value
#         else:
#             sub_dict = {}
#             for item in value.split(','):
#                 k, v = item.rsplit('=', 1)
#                 sub_dict[k] = get_value(v)
#             return sub_dict
# 
#     for line in response.splitlines():
#         if line and not line.startswith('#'):
#             if line.find(':') != -1:
#                 key, value = line.split(':', 1)
#                 info[key] = get_value(value)
#             else:
#                 # if the line isn't splittable, append it to the "__raw__" key
#                 info.setdefault('__raw__', []).append(line)
# 
#     return info
# 
# Path: tests/cluster/conftest.py
# def skip_if_server_version_lt(min_version):
#     """
#     """
#     versions = get_versions()
#     for version in versions.values():
#         if StrictVersion(version) < StrictVersion(min_version):
#             return pytest.mark.skipif(True, reason="")
#     return pytest.mark.skipif(False, reason="")
# 
# def skip_if_redis_py_version_lt(min_version):
#     """
#     """
#     import aredis
#     version = aredis.__version__
#     if StrictVersion(version) < StrictVersion(min_version):
#         return pytest.mark.skipif(True, reason="")
#     return pytest.mark.skipif(False, reason="")


# Path: tests/cluster/test_commands.py
import datetime
import re
import time
import pytest
from string import ascii_letters
from aredis.exceptions import RedisClusterException, ResponseError, DataError, RedisError
from aredis.utils import b, iteritems, iterkeys, itervalues
from aredis.commands.server import parse_info
from tests.cluster.conftest import skip_if_server_version_lt, skip_if_redis_py_version_lt

        assert await r.get('a') == b('1')
        assert await r.incrbyfloat('a', 1.1) == 2.1
        assert float(await r.get('a')) == float(2.1)

    @pytest.mark.asyncio
    async def test_keys(self, r):
        await r.flushdb()
        keys = await r.keys()
        assert keys == []
        keys_with_underscores = set(['test_a', 'test_b'])
        keys = keys_with_underscores.union(set(['testc']))
        for key in keys:
            await r.set(key, 1)
        assert set(await r.keys(pattern='test_*')) == {b(k) for k in keys_with_underscores}
        assert set(await r.keys(pattern='test*')) == {b(k) for k in keys}

    @pytest.mark.asyncio
    async def test_mget(self, r):
        await r.flushdb()
        assert await r.mget(['a', 'b']) == [None, None]
        await r.set('a', 1)
        await r.set('b', 2)
        await r.set('c', 3)
        assert await r.mget('a', 'other', 'b', 'c') == [b('1'), None, b('2'), b('3')]

    @pytest.mark.asyncio
    async def test_mset(self, r):
        await r.flushdb()
        d = {'a': b('1'), 'b': b('2'), 'c': b('3')}
        assert await r.mset(d)

        for k, v in iteritems(d):