本文整理匯總了Python中misc_utils_objectfactory.ObjFactory.object_exists方法的典型用法代碼示例。如果您正苦於以下問題:Python ObjFactory.object_exists方法的具體用法?Python ObjFactory.object_exists怎麽用?Python ObjFactory.object_exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類misc_utils_objectfactory.ObjFactory
的用法示例。
在下文中一共展示了ObjFactory.object_exists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Test_ObjFramework_Database
# 需要導入模塊: from misc_utils_objectfactory import ObjFactory [as 別名]
# 或者: from misc_utils_objectfactory.ObjFactory import object_exists [as 別名]
class Test_ObjFramework_Database(unittest.TestCase):
def setUp(self):
self.of = ObjFactory(True)
self.database = Database('foobar')
self.foobar= self.of.new(dbtblgeneric,
'DBLesson',
objid='dblesson0',
constructor='datamembers',
modname=__name__,
database=self.database,
dm={'student':'booker',
'period':2,
'dow':3})
def tearDown(self):
self.of.reset()
def test_num_obj_created(self):
self.assertEquals(len(self.of.query('DBLesson')),1)
def test_correct_keys_created(self):
self.assertTrue(self.of.object_exists('DBLesson','dblesson0'))
def test_objects_created_stored(self):
_lesson = self.of.object_get('DBLesson','dblesson0')
self.assertEquals(_lesson.__class__.__name__,"DBLesson")
def test_objects_have_attributes(self):
_lesson = self.of.object_get('DBLesson','dblesson0')
self.assertEquals(_lesson.student,'booker')
self.assertEquals(_lesson.period,2)
self.assertEquals(_lesson.dow,3)