当前位置: 首页>>代码示例>>Python>>正文


Python ObjFactory.dumpobjrpt方法代码示例

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


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

示例1: Test_ObjFrameworkDumpRpt

# 需要导入模块: from misc_utils_objectfactory import ObjFactory [as 别名]
# 或者: from misc_utils_objectfactory.ObjFactory import dumpobjrpt [as 别名]
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,代码行数:35,代码来源:test_misc_utils_objectfactory.py

示例2: Test_dump

# 需要导入模块: from misc_utils_objectfactory import ObjFactory [as 别名]
# 或者: from misc_utils_objectfactory.ObjFactory import dumpobjrpt [as 别名]
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,代码行数:28,代码来源:test_ssviewer_utils.py

示例3: Test_ObjFrameworkDumpRptNestedSchoolschedFieldNameHdr

# 需要导入模块: from misc_utils_objectfactory import ObjFactory [as 别名]
# 或者: from misc_utils_objectfactory.ObjFactory import dumpobjrpt [as 别名]
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,代码行数:53,代码来源:test_misc_utils_objectfactory.py

示例4: Test_ObjFrameworkDumpRptNestedSchoolsched

# 需要导入模块: from misc_utils_objectfactory import ObjFactory [as 别名]
# 或者: from misc_utils_objectfactory.ObjFactory import dumpobjrpt [as 别名]
class Test_ObjFrameworkDumpRptNestedSchoolsched(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',
                           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)
        
        
    def test_(self):
        from types import StringType,IntType, UnicodeType
        results = self.of.dumpobjrpt(objref=False)
        
        expected_results = [['ROOT', 'period'], 
                            ['ROOT', 'saveversion'], 
                            ['ROOT', 'dow'], 
                            ['dblesson0', 'dow'], 
                            ['dblesson0', 'period'], 
                            ['dblesson0', 'saveversion'], 
                            ['dblesson0', 'session'], 
                            ['dblesson0', 'student'], 
                            ['dblesson0', 'teacher'], 
                            ['ROOT', 'DBLesson'], 
                            ['ROOT', 'session'], 
                            ['ROOT', 'student'], 
                            ['ROOT', 'teacher']]
        
        self.assertListEqual(expected_results,results)

    def test_filter_objtype(self):
        from types import StringType,IntType, UnicodeType
        results = self.of.dumpobjrpt(objtypes=['DBLesson','student'],objref=False)
         
        expected_results = [['dblesson0', 'student'], 
                            ['ROOT', 'DBLesson'],
                            ['ROOT', 'student']]
        
        
        expected_results.sort()
        results.sort()
        
        self.assertListEqual(expected_results,results)
        
    def test_filter_objtype_3items(self):
        from types import StringType,IntType, UnicodeType
        results = self.of.dumpobjrpt(objtypes=['DBLesson','student','dow'],objref=False)
         
        expected_results = [['dblesson0', 'student'], 
                            ['ROOT', 'DBLesson'],
                            ['ROOT', 'student'],
                            ['dblesson0', 'dow'], 
                            ['ROOT', 'dow']] 
        
        
        expected_results.sort()
        results.sort()
        
        self.assertListEqual(expected_results,results)
        
    
    def test_filter_objtype_field_filters(self):
        from types import StringType,IntType, UnicodeType
        
        expected_results = [['ROOT', '-', '-', 'student'], 
                            ['ROOT', 'Amelia', 'Booker', 'DBLesson'], 
                            ['dblesson0', '-', '-', 'student']]


        results = self.of.dumpobjrpt(objtypes=['DBLesson','student'],
                                     objref=False,
                                     fields=['teacher','student'])
         
        
        expected_results.sort()
        results.sort()
        
        self.assertListEqual(expected_results,results)
        

    def test_all_fields(self):
        from types import StringType,IntType, UnicodeType
        
        expected_results = [['ROOT', 'dm:teacher=Amelia', 
#.........这里部分代码省略.........
开发者ID:burtnolej,项目名称:hungrycrayon,代码行数:103,代码来源:test_misc_utils_objectfactory.py


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