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