# Path: oslo_db/exception.py
# class DBError(CausedByException):
# class DBDuplicateEntry(DBError):
# class DBConstraintError(DBError):
# class DBReferenceError(DBError):
# class DBNonExistentConstraint(DBError):
# class DBNonExistentTable(DBError):
# class DBNonExistentDatabase(DBError):
# class DBDeadlock(DBError):
# class DBInvalidUnicodeParameter(Exception):
# class DBMigrationError(DBError):
# class DBConnectionError(DBError):
# class DBDataError(DBError):
# class DBNotSupportedError(DBError):
# class InvalidSortKey(Exception):
# class ColumnError(Exception):
# class BackendNotAvailable(Exception):
# class RetryRequest(Exception):
# class NoEngineContextEstablished(AttributeError):
# class ContextNotRequestedError(AttributeError):
# class CantStartEngineError(Exception):
#     def __init__(self, inner_exception=None, cause=None):
#     def __init__(self, columns=None, inner_exception=None, value=None):
#     def __init__(self, table, check_name, inner_exception=None):
#     def __init__(self, table, constraint, key, key_table,
#                  inner_exception=None):
#     def __init__(self, table, constraint, inner_exception=None):
#     def __init__(self, table, inner_exception=None):
#     def __init__(self, database, inner_exception=None):
#     def __init__(self, inner_exception=None):
#     def __init__(self):
#     def __init__(self, message):
#     def __init__(self, key=None):
#     def __init__(self, inner_exc):
# 
# Path: oslo_db/sqlalchemy/models.py
# class ModelBase(object):
# class ModelIterator(object):
# class TimestampMixin(object):
# class SoftDeleteMixin(object):
#     def save(self, session):
#     def __setitem__(self, key, value):
#     def __getitem__(self, key):
#     def __contains__(self, key):
#     def get(self, key, default=None):
#     def _extra_keys(self):
#     def __iter__(self):
#     def update(self, values):
#     def _as_dict(self):
#     def iteritems(self):
#     def items(self):
#     def keys(self):
#     def __init__(self, model, columns):
#     def __iter__(self):
#     def __next__(self):
#     def soft_delete(self, session):
# 
# Path: oslo_db/sqlalchemy/types.py
# class JsonEncodedType(TypeDecorator):
# class JsonEncodedDict(JsonEncodedType):
# class JsonEncodedList(JsonEncodedType):
# class SoftDeleteInteger(TypeDecorator):
# class String(_String):
#     def __init__(self, mysql_as_long=False, mysql_as_medium=False):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def process_bind_param(self, value, dialect):
#     def __init__(
#             self, length, mysql_ndb_length=None, mysql_ndb_type=None, **kw):
# 
# Path: oslo_db/tests/sqlalchemy/base.py
# class Context(object):
# class DbTestCase(db_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase):
# class MySQLOpportunisticTestCase(DbTestCase):
# class PostgreSQLOpportunisticTestCase(DbTestCase):
# class _DbTestCase(
#     db_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase,
# ):
# class _MySQLOpportunisticTestCase(_DbTestCase):
# class _PostgreSQLOpportunisticTestCase(_DbTestCase):
#     def setUp(self):
#     def setUp(self):
#     FIXTURE = db_fixtures.MySQLOpportunisticFixture
#     FIXTURE = db_fixtures.PostgresqlOpportunisticFixture
#     FIXTURE = db_fixtures.MySQLOpportunisticFixture
#     FIXTURE = db_fixtures.PostgresqlOpportunisticFixture


from sqlalchemy import Column, Integer
from sqlalchemy.dialects import mysql
from sqlalchemy.orm import declarative_base
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import models
from oslo_db.sqlalchemy import types
from oslo_db.tests.sqlalchemy import base as test_base
        self.session = self.sessionmaker()
        self.addCleanup(self.session.close)

    def test_default_value(self):
        with self.session.begin():
            JsonTable(id=1).save(self.session)
        obj = self.session.query(JsonTable).filter_by(id=1).one()
        self.assertEqual([], obj.jlist)
        self.assertEqual({}, obj.jdict)
        self.assertIsNone(obj.json)

    def test_dict(self):
        test = {'a': 42, 'b': [1, 2, 3]}
        with self.session.begin():
            JsonTable(id=1, jdict=test).save(self.session)
        obj = self.session.query(JsonTable).filter_by(id=1).one()
        self.assertEqual(test, obj.jdict)

    def test_list(self):
        test = [1, True, "hello", {}]
        with self.session.begin():
            JsonTable(id=1, jlist=test).save(self.session)
        obj = self.session.query(JsonTable).filter_by(id=1).one()
        self.assertEqual(test, obj.jlist)

    def test_dict_type_check(self):
        self.assertRaises(db_exc.DBError,
                          JsonTable(id=1, jdict=[]).save, self.session)

    def test_list_type_check(self):

# Path: oslo_db/exception.py
# class DBError(CausedByException):
# class DBDuplicateEntry(DBError):
# class DBConstraintError(DBError):
# class DBReferenceError(DBError):
# class DBNonExistentConstraint(DBError):
# class DBNonExistentTable(DBError):
# class DBNonExistentDatabase(DBError):
# class DBDeadlock(DBError):
# class DBInvalidUnicodeParameter(Exception):
# class DBMigrationError(DBError):
# class DBConnectionError(DBError):
# class DBDataError(DBError):
# class DBNotSupportedError(DBError):
# class InvalidSortKey(Exception):
# class ColumnError(Exception):
# class BackendNotAvailable(Exception):
# class RetryRequest(Exception):
# class NoEngineContextEstablished(AttributeError):
# class ContextNotRequestedError(AttributeError):
# class CantStartEngineError(Exception):
#     def __init__(self, inner_exception=None, cause=None):
#     def __init__(self, columns=None, inner_exception=None, value=None):
#     def __init__(self, table, check_name, inner_exception=None):
#     def __init__(self, table, constraint, key, key_table,
#                  inner_exception=None):
#     def __init__(self, table, constraint, inner_exception=None):
#     def __init__(self, table, inner_exception=None):
#     def __init__(self, database, inner_exception=None):
#     def __init__(self, inner_exception=None):
#     def __init__(self):
#     def __init__(self, message):
#     def __init__(self, key=None):
#     def __init__(self, inner_exc):
# 
# Path: oslo_db/sqlalchemy/models.py
# class ModelBase(object):
# class ModelIterator(object):
# class TimestampMixin(object):
# class SoftDeleteMixin(object):
#     def save(self, session):
#     def __setitem__(self, key, value):
#     def __getitem__(self, key):
#     def __contains__(self, key):
#     def get(self, key, default=None):
#     def _extra_keys(self):
#     def __iter__(self):
#     def update(self, values):
#     def _as_dict(self):
#     def iteritems(self):
#     def items(self):
#     def keys(self):
#     def __init__(self, model, columns):
#     def __iter__(self):
#     def __next__(self):
#     def soft_delete(self, session):
# 
# Path: oslo_db/sqlalchemy/types.py
# class JsonEncodedType(TypeDecorator):
# class JsonEncodedDict(JsonEncodedType):
# class JsonEncodedList(JsonEncodedType):
# class SoftDeleteInteger(TypeDecorator):
# class String(_String):
#     def __init__(self, mysql_as_long=False, mysql_as_medium=False):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def process_bind_param(self, value, dialect):
#     def __init__(
#             self, length, mysql_ndb_length=None, mysql_ndb_type=None, **kw):
# 
# Path: oslo_db/tests/sqlalchemy/base.py
# class Context(object):
# class DbTestCase(db_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase):
# class MySQLOpportunisticTestCase(DbTestCase):
# class PostgreSQLOpportunisticTestCase(DbTestCase):
# class _DbTestCase(
#     db_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase,
# ):
# class _MySQLOpportunisticTestCase(_DbTestCase):
# class _PostgreSQLOpportunisticTestCase(_DbTestCase):
#     def setUp(self):
#     def setUp(self):
#     FIXTURE = db_fixtures.MySQLOpportunisticFixture
#     FIXTURE = db_fixtures.PostgresqlOpportunisticFixture
#     FIXTURE = db_fixtures.MySQLOpportunisticFixture
#     FIXTURE = db_fixtures.PostgresqlOpportunisticFixture


# Path: oslo_db/tests/sqlalchemy/test_types.py
from sqlalchemy import Column, Integer
from sqlalchemy.dialects import mysql
from sqlalchemy.orm import declarative_base
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import models
from oslo_db.sqlalchemy import types
from oslo_db.tests.sqlalchemy import base as test_base

        self.session = self.sessionmaker()
        self.addCleanup(self.session.close)

    def test_default_value(self):
        with self.session.begin():
            JsonTable(id=1).save(self.session)
        obj = self.session.query(JsonTable).filter_by(id=1).one()
        self.assertEqual([], obj.jlist)
        self.assertEqual({}, obj.jdict)
        self.assertIsNone(obj.json)

    def test_dict(self):
        test = {'a': 42, 'b': [1, 2, 3]}
        with self.session.begin():
            JsonTable(id=1, jdict=test).save(self.session)
        obj = self.session.query(JsonTable).filter_by(id=1).one()
        self.assertEqual(test, obj.jdict)

    def test_list(self):
        test = [1, True, "hello", {}]
        with self.session.begin():
            JsonTable(id=1, jlist=test).save(self.session)
        obj = self.session.query(JsonTable).filter_by(id=1).one()
        self.assertEqual(test, obj.jlist)

    def test_dict_type_check(self):
        self.assertRaises(db_exc.DBError,
                          JsonTable(id=1, jdict=[]).save, self.session)

    def test_list_type_check(self):

        self.assertRaises(db_exc.DBError,