本文整理汇总了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()
示例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()