當前位置: 首頁>>代碼示例>>Python>>正文


Python fixtures.TestBase方法代碼示例

本文整理匯總了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 
開發者ID:sqlalchemy,項目名稱:alembic,代碼行數:18,代碼來源:plugin_base.py

示例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) 
開發者ID:sqlalchemy,項目名稱:sqlalchemy,代碼行數:32,代碼來源:test_inheritance.py

示例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) 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:7,代碼來源:noseplugin.py

示例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) 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:7,代碼來源:noseplugin.py


注:本文中的sqlalchemy.testing.fixtures.TestBase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。