# 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/helpers.py
# class ManagerTestBase(SQLAlchemyTestBase):
#     """Base class for tests that use a SQLAlchemy database and an
#     :class:`~flask_restless.APIManager`.
# 
#     Nearly all test classes should subclass this class. Since we strive
#     to make Flask-Restless compliant with plain old SQLAlchemy first,
#     the default database abstraction layer used by tests in this class
#     will be SQLAlchemy. Test classes requiring Flask-SQLAlchemy must
#     instantiate their own :class:`~flask_restless.APIManager`.
# 
#     The :class:`~flask_restless.APIManager` instance for use in
#     tests is accessible at ``self.manager``.
# 
#     """
# 
#     def setUp(self):
#         """Initializes an instance of
#         :class:`~flask_restless.APIManager` with a SQLAlchemy
#         session.
# 
#         """
#         super(ManagerTestBase, self).setUp()
#         self.manager = APIManager(self.flaskapp, session=self.session)
# 
#     # HACK If we don't include this, there seems to be an issue with the
#     # globally known APIManager objects not being cleared after every test.
#     def tearDown(self):
#         """Clear the :class:`~flask_restless.APIManager` objects
#         known by the global helper functions :data:`model_for`,
#         :data:`url_for`, etc.
# 
#         """
#         super(ManagerTestBase, self).tearDown()
#         for func in GLOBAL_FUNCS:
#             func.created_managers.clear()


from functools import partial
    from urllib.parse import unquote
    from urlparse import unquote
from sqlalchemy import Column
from sqlalchemy import Float
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import Unicode
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship
from ..helpers import loads
from ..helpers import ManagerTestBase
import re
        """
        article = self.Article(id=1)
        self.session.add(article)
        self.session.commit()
        response = self.app.get('/api/article/1/relationships/author')
        assert response.status_code == 200
        document = loads(response.data)
        person = document['data']
        assert person is None

    def test_relationship_links(self):
        """Tests for links included in relationship objects.

        For more information, see the `Fetching Relationships`_ section
        of JSON API specification.

        .. _Fetching Relationships:
           http://jsonapi.org/format/#fetching-relationships

        """
        article = self.Article(id=1)
        self.session.add(article)
        self.session.commit()
        response = self.app.get('/api/article/1/relationships/author')
        document = loads(response.data)
        links = document['links']
        assert links['self'].endswith('/article/1/relationships/author')
        assert links['related'].endswith('/article/1/author')



# 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/helpers.py
# class ManagerTestBase(SQLAlchemyTestBase):
#     """Base class for tests that use a SQLAlchemy database and an
#     :class:`~flask_restless.APIManager`.
# 
#     Nearly all test classes should subclass this class. Since we strive
#     to make Flask-Restless compliant with plain old SQLAlchemy first,
#     the default database abstraction layer used by tests in this class
#     will be SQLAlchemy. Test classes requiring Flask-SQLAlchemy must
#     instantiate their own :class:`~flask_restless.APIManager`.
# 
#     The :class:`~flask_restless.APIManager` instance for use in
#     tests is accessible at ``self.manager``.
# 
#     """
# 
#     def setUp(self):
#         """Initializes an instance of
#         :class:`~flask_restless.APIManager` with a SQLAlchemy
#         session.
# 
#         """
#         super(ManagerTestBase, self).setUp()
#         self.manager = APIManager(self.flaskapp, session=self.session)
# 
#     # HACK If we don't include this, there seems to be an issue with the
#     # globally known APIManager objects not being cleared after every test.
#     def tearDown(self):
#         """Clear the :class:`~flask_restless.APIManager` objects
#         known by the global helper functions :data:`model_for`,
#         :data:`url_for`, etc.
# 
#         """
#         super(ManagerTestBase, self).tearDown()
#         for func in GLOBAL_FUNCS:
#             func.created_managers.clear()


# Path: tests/test_jsonapi/test_fetching_data.py
from functools import partial
    from urllib.parse import unquote
    from urlparse import unquote
from sqlalchemy import Column
from sqlalchemy import Float
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import Unicode
from sqlalchemy.orm import backref
from sqlalchemy.orm import relationship
from ..helpers import loads
from ..helpers import ManagerTestBase
import re

        """
        article = self.Article(id=1)
        self.session.add(article)
        self.session.commit()
        response = self.app.get('/api/article/1/relationships/author')
        assert response.status_code == 200
        document = loads(response.data)
        person = document['data']
        assert person is None

    def test_relationship_links(self):
        """Tests for links included in relationship objects.

        For more information, see the `Fetching Relationships`_ section
        of JSON API specification.

        .. _Fetching Relationships:
           http://jsonapi.org/format/#fetching-relationships

        """
        article = self.Article(id=1)
        self.session.add(article)
        self.session.commit()
        response = self.app.get('/api/article/1/relationships/author')
        document = loads(response.data)
        links = document['links']
        assert links['self'].endswith('/article/1/relationships/author')
        assert links['related'].endswith('/article/1/author')



class TestInclusion(ManagerTestBase):