# Path: aredis/pool.py
# def to_bool(value):
#     if value is None or value == '':
#         return None
#     if isinstance(value, str) and value.upper() in FALSE_STRINGS:
#         return False
#     return bool(value)
# 
# Path: aredis/exceptions.py
# class ConnectionError(RedisError):
#     pass
# 
# class RedisError(Exception):
#     pass
# 
# class BusyLoadingError(ConnectionError):
#     pass
# 
# class ReadOnlyError(ResponseError):
#     pass
# 
# Path: tests/client/conftest.py
# def skip_if_server_version_lt(min_version):
#     loop = asyncio.get_event_loop()
#     version = StrictVersion(loop.run_until_complete(get_version()))
#     check = version < StrictVersion(min_version)
#     return pytest.mark.skipif(check, reason="")


import os
import pytest
import aredis
import re
import asyncio
        import warnings
        import ssl
from aredis.pool import to_bool
from aredis.exceptions import (ConnectionError, RedisError,
                               BusyLoadingError, ReadOnlyError)
from .conftest import skip_if_server_version_lt
        self.pid = os.getpid()
        self.awaiting_response = False


class TestConnectionPool:
    def get_pool(self, connection_kwargs=None, max_connections=None,
                 connection_class=DummyConnection):
        connection_kwargs = connection_kwargs or {}
        pool = aredis.ConnectionPool(
            connection_class=connection_class,
            max_connections=max_connections,
            **connection_kwargs)
        return pool

    def test_connection_creation(self):
        connection_kwargs = {'foo': 'bar', 'biz': 'baz'}
        pool = self.get_pool(connection_kwargs=connection_kwargs)
        connection = pool.get_connection()
        assert isinstance(connection, DummyConnection)
        assert connection.kwargs == connection_kwargs

    def test_multiple_connections(self):
        pool = self.get_pool()
        c1 = pool.get_connection()
        c2 = pool.get_connection()
        assert c1 != c2

    def test_max_connections(self):
        pool = self.get_pool(max_connections=2)
        pool.get_connection()

# Path: aredis/pool.py
# def to_bool(value):
#     if value is None or value == '':
#         return None
#     if isinstance(value, str) and value.upper() in FALSE_STRINGS:
#         return False
#     return bool(value)
# 
# Path: aredis/exceptions.py
# class ConnectionError(RedisError):
#     pass
# 
# class RedisError(Exception):
#     pass
# 
# class BusyLoadingError(ConnectionError):
#     pass
# 
# class ReadOnlyError(ResponseError):
#     pass
# 
# Path: tests/client/conftest.py
# def skip_if_server_version_lt(min_version):
#     loop = asyncio.get_event_loop()
#     version = StrictVersion(loop.run_until_complete(get_version()))
#     check = version < StrictVersion(min_version)
#     return pytest.mark.skipif(check, reason="")


# Path: tests/client/test_connection_pool.py
import os
import pytest
import aredis
import re
import asyncio
        import warnings
        import ssl
from aredis.pool import to_bool
from aredis.exceptions import (ConnectionError, RedisError,
                               BusyLoadingError, ReadOnlyError)
from .conftest import skip_if_server_version_lt

        self.pid = os.getpid()
        self.awaiting_response = False


class TestConnectionPool:
    def get_pool(self, connection_kwargs=None, max_connections=None,
                 connection_class=DummyConnection):
        connection_kwargs = connection_kwargs or {}
        pool = aredis.ConnectionPool(
            connection_class=connection_class,
            max_connections=max_connections,
            **connection_kwargs)
        return pool

    def test_connection_creation(self):
        connection_kwargs = {'foo': 'bar', 'biz': 'baz'}
        pool = self.get_pool(connection_kwargs=connection_kwargs)
        connection = pool.get_connection()
        assert isinstance(connection, DummyConnection)
        assert connection.kwargs == connection_kwargs

    def test_multiple_connections(self):
        pool = self.get_pool()
        c1 = pool.get_connection()
        c2 = pool.get_connection()
        assert c1 != c2

    def test_max_connections(self):
        pool = self.get_pool(max_connections=2)
        pool.get_connection()

        pool.get_connection()