• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python misc_utils_objectfactory.ObjFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中misc_utils_objectfactory.ObjFactory的典型用法代码示例。如果您正苦于以下问题:Python ObjFactory类的具体用法?Python ObjFactory怎么用?Python ObjFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ObjFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: Test_ObjFrameworkDumpRpt

class Test_ObjFrameworkDumpRpt(unittest.TestCase):
    
    def setUp(self):
        self.of = ObjFactory(True)
        self.obj1 = self.of.new(GenericBase,
                    'Student',
                    objid='booker',
                    nationality='british',
                    modname=__name__)
        
    def test_no_datafields(self):
        from types import StringType,IntType, UnicodeType
        expected_results = [['ROOT', 'Student']]

                
        results = self.of.dumpobjrpt(objref=False)
        
        expected_results.sort()
        results.sort()
        
        self.assertListEqual(expected_results,results)
        
    def test_inc_datafields(self):
        from types import StringType,IntType, UnicodeType
        expected_results = [['ROOT', 'british', 'Student']]

                
        results = self.of.dumpobjrpt(fields=['nationality'],objref=False)
        
        expected_results.sort()
        results.sort()
        
        self.assertListEqual(expected_results,results)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:33,代码来源:test_misc_utils_objectfactory.py


示例2: Test_ObjFramework_2_records_same_cls

class Test_ObjFramework_2_records_same_cls(unittest.TestCase):

    def setUp(self):
        self.of = ObjFactory()
        self.obj1= self.of.new(GenericBase,
                               'Student',
                               objid='booker',
                               modname=__name__,
                               name='booker',
                               age=23)
        
        self.obj2= self.of.new(GenericBase,
                               'Student',
                               objid='frank',
                               modname=__name__,
                               name='frank',
                               age=19)
        

    def tearDown(self):
        self.of.reset()
        
    def test_2records_same_class(self):
        names = [obj.name for obj in self.of.query('Student')]
        names.sort()
        self.assertEquals(names,['booker','frank'])
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:26,代码来源:test_misc_utils_objectfactory.py


示例3: Test_SchoolSched_create_secondary_objects_type

class Test_SchoolSched_create_secondary_objects_type(unittest.TestCase):
    
    # test that when a lesson object is created, all other records
    # that are new are created by asserting that the values are of
    # the correct object type

    def setUp(self):
        self.database = Database('htmlparser',True)
        self.of = ObjFactory(True)
    
    def test_(self):
        
        _dm = _cdict(['schedule_num','day_num','period_num','student_num'],[1,0,1,0])
    
        datamembers = _initdatamembers('lesson',**_dm)
    
        _enrich('QUAD CAFE',datamembers)
        
        _lesson_create(datamembers,self.database,self.of)

        attr_list = [(obj, obj.objtype) for obj in self.of.object_iter()]

        for obj in self.of.object_iter():
            self.assertTrue(isinstance(obj,eval(obj.objtype)))
            
        with self.database:
            pass
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:27,代码来源:test_schoolscheduler.py


示例4: Test_ObjFrameworkBasic

class Test_ObjFrameworkBasic(unittest.TestCase):

    def setUp(self):
        self.of = ObjFactory()

        foobar= self.of.new(GenericBase,
                            "Student",
                            objid='booker',
                            modname=__name__,
                            name='booker',
                            age=23)      

    def tearDown(self):
        self.of.reset()
        
    def test_num_obj_created(self):
        self.assertEquals(len(ObjFactory().store['Student']),1)
        
    def test_correct_keys_created(self):
        self.assertTrue(ObjFactory().store['Student'].has_key('booker'))
    
    def test_objects_created_stored(self):
        _student = ObjFactory().store['Student']['booker']
        self.assertEquals(_student.__class__.__name__,"Student")

    def test_objects_have_attributes(self):
        _student = ObjFactory().store['Student']['booker']        
        self.assertEquals(_student.name,'booker')
        self.assertEquals(_student.age,23)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:29,代码来源:test_misc_utils_objectfactory.py


示例5: Test_ObjFrameworkIter

class Test_ObjFrameworkIter(unittest.TestCase):

    def setUp(self):
        self.of = ObjFactory(True)
        self.of.new(GenericBase,
                    'Student',
                    objid='booker',
                    modname=__name__)
        
        self.of.new(GenericBase,
                    'Student',
                    objid='fred',
                    modname=__name__)
        
        self.of.new(GenericBase,
                    'Classroom',
                    objid='1a',
                    modname=__name__)
        

    def tearDown(self):
        self.of.reset()
        
    def test_iter(self):
        result = [obj.objid for obj in self.of.object_iter()]
        result.sort()
        
        self.assertListEqual(result,['1a','booker','fred'])
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:28,代码来源:test_misc_utils_objectfactory.py


示例6: Test_ObjFrameworkDumpNested

class Test_ObjFrameworkDumpNested(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='fred',
                    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',
                    nationality='swedish',
                    modname=__name__)
        

    def tearDown(self):
        self.of.reset()
        
    '''def test_1clause(self):
        results = self.of.query_advanced('Student',[('objid','booker')])
        
        self.assertEquals(len(results),1)
        self.assertEquals(results[0].objid,'booker')
        
    def test_2clause(self):
        results = self.of.query_advanced('Student',[('nationality','british'),
                                                    ('objid','fred')])
        
        self.assertEquals(len(results),1)
        self.assertEquals(results[0].age,23)'''
        
        
    def test_update_then_search(self):
        ''' make sure that search picks up the updated version of the object '''
        
        self.obj1.nationality = 'indian'
        results = self.of.query_advanced('Student',[('objid','booker')])
        
        self.assertEquals(results[0].nationality,'indian')
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:55,代码来源:test_misc_utils_objectfactory.py


示例7: Test_update

class Test_update(unittest.TestCase):
    
    def setUp(self):
        
        self.dbname='test_ssviewer_util_add'
        self.database = Database(self.dbname)
        self.of = ObjFactory(True)
        self.enums = sswizard_utils.setenums(dow="all",prep=-1,database=self.database)
        self.prepmap = sswizard_utils._loadprepmapper(self.database)

        args = dict(database=self.database,refdatabase=self.database,saveversion=1,
                    of=self.of,enums=self.enums,keepversion=True)
        ssviewer_utils.dataset_load(**args)

    def test_update_subject(self):

        expected_results = [[u'master', u'complete', u'academic', u'830-910', u'WE', u'dbinsert', u'[Dylan,Francisco].Movement.Wednesday.830-910', u'[Dylan,Francisco]', u'Nathaniel', 5, u'1.4.1.None.8', u'Movement'], 
                            [u'master', u'complete', u'academic', u'830-910', u'WE', u'dbinsert', u'[Dylan,Francisco].Movement.Wednesday.830-910', u'[Dylan,Francisco]', u'Nathaniel', 5, u'1.4.1.None.8', u'ELA']]
        
        obj = self.of.query_advanced("lesson",[('period','830-910'),
                                          ('dow','WE')])
        
        obj[0].update(self.of,'subject','ELA')
        
        with self.database:
            _,rows,_ = tbl_rows_get(self.database,"lesson",
                                    fields = ['status', 'substatus', 'recordtype', 'period', 'dow', 'source', 'session', 'teacher', 'student', 'prep', 'userobjid', 'subject'],
                                    whereclause = [["period","=","\"830-910\""],
                                                   ["dow","=","\"WE\""]])
            
        self.assertListEqual(rows,expected_results)


    def test_update_adult(self):
        
        expected_results = [[u'master', u'complete', u'academic', u'830-910', u'WE', u'dbinsert', u'[Dylan,Francisco].Movement.Wednesday.830-910', u'[Dylan,Francisco]', u'Nathaniel', 5, u'1.4.1.None.8', u'Movement'], 
                            [u'master', u'complete', u'academic', u'830-910', u'WE', u'dbinsert', u'[Dylan,Francisco].Movement.Wednesday.830-910', u'Amelia', u'Nathaniel', 5, u'1.4.1.None.8', u'Movement']]
        
        obj = self.of.query_advanced("lesson",[('period','830-910'),
                                          ('dow','WE')])
        
        obj[0].update(self.of,'teacher','Amelia')
        
        with self.database:
            _,rows,_ = tbl_rows_get(self.database,"lesson",
                                    fields = ['status', 'substatus', 'recordtype', 'period', 'dow', 'source', 'session', 'teacher', 'student', 'prep', 'userobjid', 'subject'],
                                    whereclause = [["period","=","\"830-910\""],
                                                   ["dow","=","\"WE\""]])
            
        self.assertListEqual(rows,expected_results)
        
    def tearDown(self):
        shutil.copyfile(self.dbname+".sqlite.backup",self.dbname + ".sqlite")
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:53,代码来源:test_ssviewer_utils.py


示例8: Test_ObjFrameworkDumpRptNestedSchoolschedFieldNameHdr

class Test_ObjFrameworkDumpRptNestedSchoolschedFieldNameHdr(unittest.TestCase):
    
    # same as above just with the school sched nested object
    # so each attr is another object of (not a string or int) that 
    # potentially needs to be accessed via accessors
    def setUp(self):
        self.of = ObjFactory(True)
        self.database = Database('foobar')
        
        datamembers = dict(period='830-910',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-950',student='Booker',dow='MO',
                           teacher='Stan',saveversion=0,session='AM.AC.SC')

        self.foobar= self.of.new(schoolschedgeneric,'DBLesson',objid='dblesson1',constructor='datamembers',database=self.database,of=self.of,modname=__name__,dm=datamembers)
        

        datamembers = dict(period='950-1020',student='Booker',dow='MO',
                           teacher='Samantha',saveversion=0,session='AM.AC.SC')

        self.foobar= self.of.new(schoolschedgeneric,'DBLesson',objid='dblesson2',constructor='datamembers',database=self.database,of=self.of,modname=__name__,dm=datamembers)
    

        datamembers = dict(period='830-910',student='Clayton',dow='MO',
                           teacher='Samantha',saveversion=0,session='AM.AC.SC')

        self.foobar= self.of.new(schoolschedgeneric,'DBLesson',objid='dblesson3',constructor='datamembers',database=self.database,of=self.of,modname=__name__,dm=datamembers)
        
    def test_1constraint(self):
        from types import StringType,IntType, UnicodeType
        
        expected_results = [['ROOT', 'student:Booker', 'period:830-910', 'objtype:DBLesson'], 
                            ['ROOT', 'student:Clayton', 'period:830-910', 'objtype:DBLesson']]

        results = self.of.dumpobjrpt(objtypes=['DBLesson'],
                                     objref=False,
                                     fields=['student','period'],
                                     omitfields=['id'], 
					fieldnames=True)
         
        
        expected_results.sort()
        results.sort()

        self.assertListEqual(expected_results,results)

        self.assertListEqual(expected_results,results)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:51,代码来源:test_misc_utils_objectfactory.py


示例9: Test_SchoolSched_schdule_load_1lesson

class Test_SchoolSched_schdule_load_1lesson(unittest.TestCase):

    def setUp(self):
        self.database = Database('htmlparser')
        self.of = ObjFactory(True)
        
        f = "/home/burtnolej/Development/pythonapps3/clean/apps/schoolscheduler/schedule.html" 
        self.schedule = htmlschedule_slice(f,num_periods=1,num_students=1,num_days=1)

        schedule_load(self.schedule, self.of, self.database)
        
    def test_schdload_lesson(self):
        schedule_load(self.schedule, self.of, self.database)
        
        exp_res = ['0.0.0']
        exp_res.sort()
        
        _res = self.of.query('lesson')
        
        
        _resstr =  [str(_r) for _r in _res]
        _resstr.sort()
        
        self.assertListEqual(exp_res, _resstr)

        
    def test_schdload_subject(self):
        schedule_load(self.schedule, self.of, self.database)
        
        _res = self.of.query('subject')        
        _resstr =  [str(_r) for _r in _res] 
        
        _resstr.sort()
        
        self.assertListEqual(['MOVEMENT'],
                             _resstr)
        
    def test_schdload_objtype(self):
        schedule_load(self.schedule, self.of, self.database)
        
        exp_res = ['period','student','dow','lessontype','subject','lesson']
        exp_res.sort()
        
        _res = self.of.query('objtype')        
        _resstr =  [str(_r) for _r in _res] 
        
        _resstr.sort()
        
        self.assertListEqual(exp_res,_resstr)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:49,代码来源:test_schoolscheduler.py


示例10: setUp

 def setUp(self):
     self.of = ObjFactory(True)
     self.obj1 = self.of.new(GenericBase,
                 'Student',
                 objid='booker',
                 nationality='british',
                 modname=__name__)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:7,代码来源:test_misc_utils_objectfactory.py


示例11: __init__

    def __init__(self,dbname,refdbname):
        
        log.log(thisfuncname(),3,msg="initialize",dbname=dbname,refdbname=refdbname)

        self.colorpalette = dict(wp=green,subject=lightblue,ap='yellow',
                                 Movement=pink,ELA=salmon,Humanities=lightyellow,
                                 Counseling=lightgreen,Math=lightturquoise, 
                                 Music=lightblue,STEM=lavender,Art=purple,History=pink,
                                 Science=darkgreen,Core=karky,Chess=burgundy,
                                 computertime='darkgrey',Speech=darkburgundy,
                                 Student_News=darkgrey,Computer_Time=brown,
                                 Activity_Period=mauve,Melissa=navyblue,Amelia=darkgreen,
                                 Samantha=darkyellow, Alexa=paleblue, Paraic=palegreen, 
                                 Francisco=cerise,Rahul=verydarkgrey,Dylan=verydarkgrey,
                                 Moira=verydarkgrey,Issey=verydarkgrey, Daryl=verydarkgrey, 
                                 Karolina=verydarkgrey)
        

        self.fontpalette = dict(Amelia=green,Paraic=darkgreen,Stan=lavender,
                                Samantha=lightgreen,Alexa=blue,Francisco=purple,
                                Melissa=lightblue,Rahul=dirtyyellow,Dylan=dirtyyellow, 
                                Moira=dirtyyellow,Issey=dirtyyellow, Daryl=dirtyyellow, 
                                Karolina=dirtyyellow,Chess=pink,Student_News=lightyellow,
                                subject=blue)
        
        
        self.of = ObjFactory(True)
        
        self.refdatabase = Database(refdbname)        
        self.dbname = dbname
        self.database = Database(self.dbname)
        self.lastsaveversion=0
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:32,代码来源:ssviewer_headless.py


示例12: Test_dump

class Test_dump(unittest.TestCase):
    
    def setUp(self):
        
        self.dbname='test_ssviewer_rest_dump'
        self.database = Database(self.dbname)
        self.of = ObjFactory(True)
        self.enums = sswizard_utils.setenums(dow="all",prep=-1,database=self.database)
        self.prepmap = sswizard_utils._loadprepmapper(self.database)

        args = dict(database=self.database,refdatabase=self.database,saveversion=1,of=self.of,enums=self.enums)
        ssviewer_utils.dataset_load(**args)

    def test_(self):
        
        expected_results = [[u'1.2.2.6.22', '-', '-', 'subject'], 
                            ['ROOT', u'Amelia', u'Clayton', 'lesson'], 
                            ['ROOT', '-', '-', 'subject']]
        
        result = self.of.dumpobjrpt(objtypes=['lesson','subject'],objref=False,
                                    fields=['adult','student'])
        
        self.assertListEqual(result,expected_results)
        
    def tearDown(self):
        shutil.copyfile(self.dbname+".sqlite.backup",self.dbname + ".sqlite")
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:26,代码来源:test_ssviewer_utils.py


示例13: setUp

 def setUp(self):
     self.database = Database('htmlparser')
     self.of = ObjFactory(True)
     
     self._create('Math WP With: Moira', [1,2,7,0])
     self._create('HUMANITIES',[1,4,9,0])
     self._create('Math WP With: Moira',[1,2,3,0])
     self._persist()
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:8,代码来源:test_schoolscheduler.py


示例14: Test_ObjFramework_Database_Derived_DB

class Test_ObjFramework_Database_Derived_DB(unittest.TestCase):
    def setUp(self):
        self.of = ObjFactory(True)
        self.database = Database('foobar')
        
        datamembers = dict(period='830',
                           student='Booker',
                           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)
        self.foobar.keepversion = True
        
    def test_persist(self):

        with self.database:
            self.foobar.persist()

        self.database = Database('foobar',True)
        with self.database:
            col_name,tbl_rows,_ = tbl_rows_get(self.database,'DBLesson',['student','teacher']) 
            
            self.assertEquals([['Booker','Amelia']],tbl_rows)
            
    def test_persist_customtimestamp(self):
        
        self.foobar.customtimestamp = "%y%m%d_%H%M%S"
        with self.database:
            self.foobar.persist()

        self.database = Database('foobar',True)
        with self.database:
            col_name,tbl_rows,_ = tbl_rows_get(self.database,'DBLesson',['__timestamp']) 
            
            self.assertTrue(13,len(tbl_rows[0][0]))
            
    def test_update_1field(self):
        
        expected_results = [[u'830', u'AM.AC.SC', u'Booker', u'Amelia', u'version'], 
                            [u'830', u'AM.AC.SC', u'Booker', u'Aaron', u'current']]
        self.foobar.customtimestamp = "%y%m%d_%H%M%S"
        with self.database:
            self.foobar.persist()
            self.foobar.update('teacher',"\"Aaron\"")

        self.database = Database('foobar',True)
        with self.database:
            col_name,tbl_rows,_ = tbl_rows_get(self.database,'DBLesson',['period','session','student','teacher','__version'] ) 
            
            self.assertListEqual(tbl_rows,expected_results)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:58,代码来源:test_misc_utils_objectfactory.py


示例15: Test_ObjFramework_Database

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)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:35,代码来源:test_misc_utils_objectfactory.py


示例16: Test_SchoolSched_htmlschedule_slice_2periods_1student_persist

class Test_SchoolSched_htmlschedule_slice_2periods_1student_persist(unittest.TestCase):
    
    def setUp(self):
        filename = "/home/burtnolej/Development/pythonapps3/clean/apps/schoolscheduler/schedule.html"
        self.schedule = htmlschedule_slice(filename,
                                           num_periods = 2,
                                           num_students = 1)
        
        self.database = Database('htmlparser')
        self.of = ObjFactory(True)
        
        schedule_load(self.schedule,self.of,self.database)
        
    def test_content_subject(self):
        
        exp_res = ['MOVEMENT', 'CHESS', 'CORE','STEM','YOGA','ART','READING PERIOD','SCIENCE']

        res = [str(res) for res in self.of.query('subject')]
        self.assertListEqual(res,exp_res)
        
    def test_content_teacher(self):
        
        exp_res = ['RAHUL', 'NATHANIEL']
        res = [str(res) for res in self.of.query('teacher')]
        self.assertListEqual(res,exp_res)
        
    def test_content_student(self):
        
        exp_res = ['NATHANIEL']
        res = [str(res) for res in self.of.query('student')]
        self.assertListEqual(res,exp_res)
        
    def test_content_userdefid(self):
        
        exp_res = ['0.0.0','0.1.0','0.2.0','0.3.0','0.4.0',
                   '0.0.1','0.1.1','0.2.1','0.3.1','0.4.1']
        res = [str(res) for res in self.of.query('userdefid')]
        self.assertListEqual(res,exp_res) 
        
    def test_content_lessontype(self):
        
        exp_res = ['other','break','edu']
        res = [str(res) for res in self.of.query('lessontype')]
        self.assertListEqual(res,exp_res)  
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:44,代码来源:test_schoolscheduler_htmlparser.py


示例17: Test_ObjFrameworkGetByVal

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)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:44,代码来源:test_misc_utils_objectfactory.py


示例18: setUp

    def setUp(self):
        
        self.dbname='test_ssviewer_rest_dump'
        self.database = Database(self.dbname)
        self.of = ObjFactory(True)
        self.enums = sswizard_utils.setenums(dow="all",prep=-1,database=self.database)
        self.prepmap = sswizard_utils._loadprepmapper(self.database)

        args = dict(database=self.database,refdatabase=self.database,saveversion=1,of=self.of,enums=self.enums)
        ssviewer_utils.dataset_load(**args)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:10,代码来源:test_ssviewer_utils.py


示例19: Test_ObjFrameworkDupeID

class Test_ObjFrameworkDupeID(unittest.TestCase):

    def setUp(self):
        self.of = ObjFactory()
        self.obj1= self.of.new(GenericBase,
                               'Student',
                               objid='booker',
                               modname=__name__)
        
        self.obj2= self.of.new(GenericBase,
                               'Student',
                               objid='booker',
                               modname=__name__)
        

    def tearDown(self):
        self.of.reset()
        
    def test_num_dupe_objid(self):
        self.assertEqual(self.obj1,self.obj2)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:20,代码来源:test_misc_utils_objectfactory.py


示例20: Test_ObjFramework_Database_Derived

class Test_ObjFramework_Database_Derived(unittest.TestCase):
    # pass in a subclass of dbtblgeneric as a baseclass; testing a bug found
    # in schoolschedulewizard
    
    class Dummy(dbtblgeneric):
        pass
    
    def setUp(self):
        self.of = ObjFactory(True)
        self.database = Database('foobar')
        self.foobar= self.of.new(self.Dummy,
                                 'DBLesson',
                                 objid='dblesson0',
                                 constructor='datamembers',
                                 modname=__name__,
                                 database=self.database,
                                 dm={'student':'booker',
                                     'period':2,
                                     'dow':3})
        
    def test_num_obj_created(self):
        self.assertEquals(len(self.of.query('DBLesson')),1)
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:22,代码来源:test_misc_utils_objectfactory.py



注:本文中的misc_utils_objectfactory.ObjFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python miscellaneous.sqrt函数代码示例发布时间:2022-05-27
下一篇:
Python miscUtils.LogMessages类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap