當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。