本文整理汇总了Python中sqlalchemy.testing.fixtures.TestBase方法的典型用法代码示例。如果您正苦于以下问题:Python fixtures.TestBase方法的具体用法?Python fixtures.TestBase怎么用?Python fixtures.TestBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy.testing.fixtures
的用法示例。
在下文中一共展示了fixtures.TestBase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: want_class
# 需要导入模块: from sqlalchemy.testing import fixtures [as 别名]
# 或者: from sqlalchemy.testing.fixtures import TestBase [as 别名]
def want_class(name, cls):
from sqlalchemy.testing import config
from sqlalchemy.testing import fixtures
if not issubclass(cls, fixtures.TestBase):
return False
elif name.startswith("_"):
return False
elif (
config.options.backend_only
and not getattr(cls, "__backend__", False)
and not getattr(cls, "__sparse_backend__", False)
):
return False
else:
return True
示例2: test_columns_single_inheritance_cascading_resolution_pk
# 需要导入模块: from sqlalchemy.testing import fixtures [as 别名]
# 或者: from sqlalchemy.testing.fixtures import TestBase [as 别名]
def test_columns_single_inheritance_cascading_resolution_pk(self):
"""An additional test for #4352 in terms of the requested use case.
"""
class TestBase(Base):
__abstract__ = True
@declared_attr.cascading
def id(cls):
col_val = None
if TestBase not in cls.__bases__:
col_val = cls.__table__.c.get("id")
if col_val is None:
col_val = Column(Integer, primary_key=True)
return col_val
class Person(TestBase):
"""single table base class"""
__tablename__ = "person"
class Engineer(Person):
""" single table inheritance, no extra cols """
class Manager(Person):
""" single table inheritance, no extra cols """
is_(Engineer.id.property.columns[0], Person.__table__.c.id)
is_(Manager.id.property.columns[0], Person.__table__.c.id)
示例3: startContext
# 需要导入模块: from sqlalchemy.testing import fixtures [as 别名]
# 或者: from sqlalchemy.testing.fixtures import TestBase [as 别名]
def startContext(self, ctx):
if not isinstance(ctx, type) \
or not issubclass(ctx, fixtures.TestBase):
return
plugin_base.start_test_class(ctx)
示例4: stopContext
# 需要导入模块: from sqlalchemy.testing import fixtures [as 别名]
# 或者: from sqlalchemy.testing.fixtures import TestBase [as 别名]
def stopContext(self, ctx):
if not isinstance(ctx, type) \
or not issubclass(ctx, fixtures.TestBase):
return
plugin_base.stop_test_class(ctx)