# Path: models/bases.py
# NO_VALUE = sa_symbol('NO_VALUE')
# class Base(object):
# class BaseModel(Base):
#     def __repr__(self):
#     def __str__(self):
#     def __tablename__(cls):  # pylint: disable=no-self-argument
#     def delete(self):
#     def _prepare_conditions(cls, conditions):
#     def get_all(cls, conditions=None):
#     def get_by_pk(cls, the_id):
#     def save(self, flush=False):


    from builtins import *  # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import
from models import bases
    import sys
import warnings
import sqlalchemy as sa
import sqlalchemy.orm as saorm
import ourmarshmallow
    converter._add_relationship_kwargs(kwargs, Nodes.parent.prop)  # pylint: disable=protected-access
    assert kwargs['schema'] == 'NodesSchema'
    assert kwargs['many'] is False
    assert kwargs['type_'] == 'nodes'
    assert kwargs['attribute'] == 'parent'
    assert kwargs['relationship_name'] == 'parent'
    assert kwargs['parent_self_url'] == NodesSchema.opts.self_url
    assert kwargs['self_url_kwargs'] == NodesSchema.opts.self_url_kwargs

def test_many_relationship_kwargs():
    """ Confirm correct defaults are set on Relation properties for to many relations. """
    converter = ourmarshmallow.convert.ModelConverter(schema_cls=NodesSchema)
    kwargs = {}
    converter._add_relationship_kwargs(kwargs, Nodes.children.prop)  # pylint: disable=protected-access
    assert kwargs['schema'] == 'NodesSchema'
    assert kwargs['many'] is True
    assert kwargs['type_'] == 'nodes'
    assert kwargs['attribute'] == 'children'
    assert kwargs['relationship_name'] == 'children'
    assert kwargs['parent_self_url'] == NodesSchema.opts.self_url
    assert kwargs['self_url_kwargs'] == NodesSchema.opts.self_url_kwargs

def test_manytomany_relations():
    """ All DIRECTION_MAPPING should be False, and property2field should return a Relationship for
    list relations. """
    for _, is_many in ourmarshmallow.convert.ModelConverter.DIRECTION_MAPPING.items():
        assert is_many is False

    # marshmallow-sqlalchemy.convert turns directional properties into Lists, but we want to use
    # our Relationship fields.

# Path: models/bases.py
# NO_VALUE = sa_symbol('NO_VALUE')
# class Base(object):
# class BaseModel(Base):
#     def __repr__(self):
#     def __str__(self):
#     def __tablename__(cls):  # pylint: disable=no-self-argument
#     def delete(self):
#     def _prepare_conditions(cls, conditions):
#     def get_all(cls, conditions=None):
#     def get_by_pk(cls, the_id):
#     def save(self, flush=False):


# Path: tests/ourmarshmallow/test_convert.py
    from builtins import *  # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import
from models import bases
    import sys
import warnings
import sqlalchemy as sa
import sqlalchemy.orm as saorm
import ourmarshmallow

    converter._add_relationship_kwargs(kwargs, Nodes.parent.prop)  # pylint: disable=protected-access
    assert kwargs['schema'] == 'NodesSchema'
    assert kwargs['many'] is False
    assert kwargs['type_'] == 'nodes'
    assert kwargs['attribute'] == 'parent'
    assert kwargs['relationship_name'] == 'parent'
    assert kwargs['parent_self_url'] == NodesSchema.opts.self_url
    assert kwargs['self_url_kwargs'] == NodesSchema.opts.self_url_kwargs

def test_many_relationship_kwargs():
    """ Confirm correct defaults are set on Relation properties for to many relations. """
    converter = ourmarshmallow.convert.ModelConverter(schema_cls=NodesSchema)
    kwargs = {}
    converter._add_relationship_kwargs(kwargs, Nodes.children.prop)  # pylint: disable=protected-access
    assert kwargs['schema'] == 'NodesSchema'
    assert kwargs['many'] is True
    assert kwargs['type_'] == 'nodes'
    assert kwargs['attribute'] == 'children'
    assert kwargs['relationship_name'] == 'children'
    assert kwargs['parent_self_url'] == NodesSchema.opts.self_url
    assert kwargs['self_url_kwargs'] == NodesSchema.opts.self_url_kwargs

def test_manytomany_relations():
    """ All DIRECTION_MAPPING should be False, and property2field should return a Relationship for
    list relations. """
    for _, is_many in ourmarshmallow.convert.ModelConverter.DIRECTION_MAPPING.items():
        assert is_many is False

    # marshmallow-sqlalchemy.convert turns directional properties into Lists, but we want to use
    # our Relationship fields.

    converter = ourmarshmallow.convert.ModelConverter(schema_cls=NodesSchema)