当前位置: 首页>>代码示例>>Python>>正文


Python PersistenceManager.populate_reference_tables方法代码示例

本文整理汇总了Python中persistence.PersistenceManager.populate_reference_tables方法的典型用法代码示例。如果您正苦于以下问题:Python PersistenceManager.populate_reference_tables方法的具体用法?Python PersistenceManager.populate_reference_tables怎么用?Python PersistenceManager.populate_reference_tables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在persistence.PersistenceManager的用法示例。


在下文中一共展示了PersistenceManager.populate_reference_tables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DatabaseTestCase

# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import populate_reference_tables [as 别名]
class DatabaseTestCase(unittest.TestCase):

    def setUp(self):
        self.persistence_manager = PersistenceManager(True)

        #just keep a top level reference to these guys for ease of use
        self.session = db_connector.get_session()

        #and then create the database schema, reference tables
        self.persistence_manager.create_schema()
        self.persistence_manager.populate_reference_tables()
        self.session.commit()

    def tearDown(self):

#        self.session.flush()
        self.session.close_all()
        self.persistence_manager.drop_schema()
开发者ID:chrisalleng,项目名称:xwlists,代码行数:20,代码来源:persistence_tests.py

示例2: len

# 需要导入模块: from persistence import PersistenceManager [as 别名]
# 或者: from persistence.PersistenceManager import populate_reference_tables [as 别名]
        self.assertEqual( DiceFace.EVADE, adjustment.to_dice.dice_face)

        result = throw.results[2]
        self.assertEqual( 3, result.dice_num)
        self.assertEqual( DiceType.GREEN, result.dice.dice_type)
        self.assertEqual( DiceFace.FOCUS, result.dice.dice_face)
        self.assertEqual( DiceFace.EVADE, result.final_dice.dice_face)
        self.assertEqual( 1, len (result.adjustments))

        adjustment = result.adjustments[0]
        self.assertEqual( adjustment.base_result_id, result.id)
        self.assertEqual( DiceThrowAdjustmentType.CONVERT, adjustment.adjustment_type)
        self.assertEqual( DiceFace.FOCUS, adjustment.from_dice.dice_face )
        self.assertEqual( DiceFace.EVADE, adjustment.to_dice.dice_face)



if __name__ == "__main__":
    if len (sys.argv) == 1:
        unittest.main()
    elif sys.argv[1] == 'create':
        pm = PersistenceManager(db_connector)
        pm.create_schema()
        pm.populate_reference_tables()
        db_connector.get_session().commit()
        db_connector.get_session().close_all()
    elif sys.argv[1] == 'destroy':
        pm = PersistenceManager(db_connector)
        pm.drop_schema()
        db_connector.get_session().commit()
        db_connector.get_session().close_all()
开发者ID:lhayhurst,项目名称:ladyluck,代码行数:33,代码来源:persistence_tests.py


注:本文中的persistence.PersistenceManager.populate_reference_tables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。