本文整理匯總了Python中misc_utils_objectfactory.ObjFactory.dump方法的典型用法代碼示例。如果您正苦於以下問題:Python ObjFactory.dump方法的具體用法?Python ObjFactory.dump怎麽用?Python ObjFactory.dump使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類misc_utils_objectfactory.ObjFactory
的用法示例。
在下文中一共展示了ObjFactory.dump方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Test_ObjFrameworkDump
# 需要導入模塊: from misc_utils_objectfactory import ObjFactory [as 別名]
# 或者: from misc_utils_objectfactory.ObjFactory import dump [as 別名]
class Test_ObjFrameworkDump(unittest.TestCase):
def setUp(self):
self.of = ObjFactory(True)
self.obj1 = self.of.new(GenericBase,
'Student',
objid='booker',
nationality='british',
modname=__name__)
self.of.new(GenericBase,
'Student',
objid='dave',
age=23,
nationality='british',
modname=__name__)
self.of.new(GenericBase,
'Student',
objid='fred',
age=35,
nationality='irish',
modname=__name__)
self.of.new(GenericBase,
'Classroom',
objid='1a',
modname=__name__)
def test_(self):
results = self.of.dump()
expected_results = [dict(objtype='Student',objid='booker',nationality='british'),
dict(objtype='Student',objid='dave',nationality='british',age=23),
dict(objtype='Student',objid='fred',nationality='irish',age=35),
dict(objtype='Classroom',objid='1a')]