# Path: tests/helpers.py
# MSIE8_UA = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'
# MSIE9_UA = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'
# IS_PYTHON2 = (sys.version_info[0] == 2)
# CLASS_TYPES = (types.TypeType, types.ClassType) if IS_PYTHON2 else (type, )
# GLOBAL_FUNCS = [model_for, url_for, collection_name, serializer_for,
#                 primary_key_for]
# class raise_s_exception(DefaultSerializer):
# class raise_d_exception(DefaultDeserializer):
# class GUID(TypeDecorator):
# class BetterJSONEncoder(json.JSONEncoder):
# class FlaskTestBase(TestCase):
# class DatabaseMixin(object):
# class FlaskSQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class SQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class ManagerTestBase(SQLAlchemyTestBase):
#     def serialize(self, instance, *args, **kw):
#     def serialize_many(self, instances, *args, **kw):
#     def deserialize(self, *args, **kw):
#     def deserialize_many(self, *args, **kw):
# def isclass(obj):
# def parse_version(version_string):
# def unregister_fsa_session_signals():
# def check_sole_error(response, status, strings):
# def force_content_type_jsonapi(test_client):
#     def set_content_type(func):
#         def new_func(*args, **kw):
#     def load_dialect_impl(self, dialect):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def default(self, obj):
#     def setUp(self):
#     def database_uri(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
# 
# Path: tests/test_filtering.py
# class SearchTestBase(ManagerTestBase):
#     """Provides a search method that simplifies a fetch request with filtering
#     query parameters.
# 
#     """
# 
#     def search(self, url, filters=None, single=None):
#         """Convenience function for performing a filtered :http:method:`get`
#         request.
# 
#         `url` is the ``path`` part of the URL to which the request will be
#         sent.
# 
#         If `filters` is specified, it must be a Python list containing filter
#         objects. It specifies how to set the ``filter[objects]`` query
#         parameter.
# 
#         If `single` is specified, it must be a Boolean. It specifies how to set
#         the ``filter[single]`` query parameter.
# 
#         """
#         if filters is None:
#             filters = []
#         # The value provided to the `separators` keyword argument
#         # minimizes whitespace.
#         filters_str = dumps(filters, separators=(',', ':'))
#         params = {'filter[objects]': filters_str}
#         if single is not None:
#             params['filter[single]'] = 1 if single else 0
#         return self.app.get(url, query_string=params)


    import psycopg2  # noqa
    from psycopg2cffi import compat
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy.dialects.postgresql import INET
from sqlalchemy.exc import OperationalError
from .helpers import loads
from .test_filtering import SearchTestBase
           inet '192.168.1/24' <<= inet '192.168.1/24'

        """
        network1 = self.Network(id=1, address='192.168.1/24')
        network2 = self.Network(id=2, address='192.168.1.5')
        network3 = self.Network(id=3, address='192.168.2.1')
        self.session.add_all([network1, network2, network3])
        self.session.commit()
        filters = [dict(name='address', op='<<=', val='192.168.1/24')]
        response = self.search('/api/network', filters)
        document = loads(response.data)
        networks = document['data']
        assert ['1', '2'] == sorted(network['id'] for network in networks)

    def test_contains(self):
        """Test for the ``>>`` ("contains") operator.

        For example:

        .. sourcecode:: postgresql

           inet '192.168.1/24' >> inet '192.168.1.5'

        """
        network1 = self.Network(id=1, address='192.168.1/24')
        network2 = self.Network(id=2, address='192.168.2/24')
        self.session.add_all([network1, network2])
        self.session.commit()
        filters = [dict(name='address', op='>>', val='192.168.1.5')]
        response = self.search('/api/network', filters)

# Path: tests/helpers.py
# MSIE8_UA = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'
# MSIE9_UA = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'
# IS_PYTHON2 = (sys.version_info[0] == 2)
# CLASS_TYPES = (types.TypeType, types.ClassType) if IS_PYTHON2 else (type, )
# GLOBAL_FUNCS = [model_for, url_for, collection_name, serializer_for,
#                 primary_key_for]
# class raise_s_exception(DefaultSerializer):
# class raise_d_exception(DefaultDeserializer):
# class GUID(TypeDecorator):
# class BetterJSONEncoder(json.JSONEncoder):
# class FlaskTestBase(TestCase):
# class DatabaseMixin(object):
# class FlaskSQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class SQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class ManagerTestBase(SQLAlchemyTestBase):
#     def serialize(self, instance, *args, **kw):
#     def serialize_many(self, instances, *args, **kw):
#     def deserialize(self, *args, **kw):
#     def deserialize_many(self, *args, **kw):
# def isclass(obj):
# def parse_version(version_string):
# def unregister_fsa_session_signals():
# def check_sole_error(response, status, strings):
# def force_content_type_jsonapi(test_client):
#     def set_content_type(func):
#         def new_func(*args, **kw):
#     def load_dialect_impl(self, dialect):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def default(self, obj):
#     def setUp(self):
#     def database_uri(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
# 
# Path: tests/test_filtering.py
# class SearchTestBase(ManagerTestBase):
#     """Provides a search method that simplifies a fetch request with filtering
#     query parameters.
# 
#     """
# 
#     def search(self, url, filters=None, single=None):
#         """Convenience function for performing a filtered :http:method:`get`
#         request.
# 
#         `url` is the ``path`` part of the URL to which the request will be
#         sent.
# 
#         If `filters` is specified, it must be a Python list containing filter
#         objects. It specifies how to set the ``filter[objects]`` query
#         parameter.
# 
#         If `single` is specified, it must be a Boolean. It specifies how to set
#         the ``filter[single]`` query parameter.
# 
#         """
#         if filters is None:
#             filters = []
#         # The value provided to the `separators` keyword argument
#         # minimizes whitespace.
#         filters_str = dumps(filters, separators=(',', ':'))
#         params = {'filter[objects]': filters_str}
#         if single is not None:
#             params['filter[single]'] = 1 if single else 0
#         return self.app.get(url, query_string=params)


# Path: tests/test_filtering_postgresql.py
    import psycopg2  # noqa
    from psycopg2cffi import compat
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy.dialects.postgresql import INET
from sqlalchemy.exc import OperationalError
from .helpers import loads
from .test_filtering import SearchTestBase

           inet '192.168.1/24' <<= inet '192.168.1/24'

        """
        network1 = self.Network(id=1, address='192.168.1/24')
        network2 = self.Network(id=2, address='192.168.1.5')
        network3 = self.Network(id=3, address='192.168.2.1')
        self.session.add_all([network1, network2, network3])
        self.session.commit()
        filters = [dict(name='address', op='<<=', val='192.168.1/24')]
        response = self.search('/api/network', filters)
        document = loads(response.data)
        networks = document['data']
        assert ['1', '2'] == sorted(network['id'] for network in networks)

    def test_contains(self):
        """Test for the ``>>`` ("contains") operator.

        For example:

        .. sourcecode:: postgresql

           inet '192.168.1/24' >> inet '192.168.1.5'

        """
        network1 = self.Network(id=1, address='192.168.1/24')
        network2 = self.Network(id=2, address='192.168.2/24')
        self.session.add_all([network1, network2])
        self.session.commit()
        filters = [dict(name='address', op='>>', val='192.168.1.5')]
        response = self.search('/api/network', filters)

        document = loads(response.data)