本文整理匯總了Python中misc_utils_objectfactory.ObjFactory.object_get_byval方法的典型用法代碼示例。如果您正苦於以下問題:Python ObjFactory.object_get_byval方法的具體用法?Python ObjFactory.object_get_byval怎麽用?Python ObjFactory.object_get_byval使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類misc_utils_objectfactory.ObjFactory
的用法示例。
在下文中一共展示了ObjFactory.object_get_byval方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Test_ObjFrameworkGetByVal
# 需要導入模塊: from misc_utils_objectfactory import ObjFactory [as 別名]
# 或者: from misc_utils_objectfactory.ObjFactory import object_get_byval [as 別名]
class Test_ObjFrameworkGetByVal(unittest.TestCase):
# test we can find an return an object given the type and the value
def setUp(self):
self.of = ObjFactory(True)
self.database = Database('foobar')
datamembers = dict(period='830',
student='Booker',
dow='MO',
teacher='Amelia',
saveversion=0,
session='AM.AC.SC')
self.foobar= self.of.new(schoolschedgeneric,
'DBLesson',
objid='dblesson0',
constructor='datamembers',
database=self.database,
of=self.of,
modname=__name__,
dm=datamembers)
datamembers = dict(period='910',
student='Clayton',
dow='TU',
teacher='Stan',
saveversion=0,
session='ST.AC.SC')
self.foobar= self.of.new(schoolschedgeneric,
'DBLesson',
objid='dblesson1',
constructor='datamembers',
database=self.database,
of=self.of,
modname=__name__,
dm=datamembers)
def test_(self):
self.assertEquals(self.of.object_get_byval("period","830").name,"830")
self.assertEquals(self.of.object_get_byval("period","910").name,"910")
self.assertEquals(self.of.object_get_byval("period","foobar"),None)