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


Python Report.add_table方法代码示例

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


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

示例1: test_to_dict_multi

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_table [as 别名]
    def test_to_dict_multi(self):
        """
        Multiple complex elements.
        The id of report sub elements is prepended with the id of the parent
        element when to_dict is called.
        """
        r = Report('redfang')
        a = Attribute('a', 'b')
        a2 = Attribute('a2', 'b2')
        r.add_attribute(a)
        r.add_attribute(a2)

        pg = PlotGroup('pgid')
        pg.add_plot(Plot('pid', 'anImg'))
        pg.add_plot(Plot('pid2', 'anImg2'))
        r.add_plotgroup(pg)

        pg = PlotGroup('pgid2')
        pg.add_plot(Plot('pid2', 'anImg2'))
        pg.add_plot(Plot('pid22', 'anImg22'))
        r.add_plotgroup(pg)

        t = Table('tabid')
        t.add_column(Column('c1'))
        r.add_table(t)

        t = Table('tabid2')
        t.add_column(Column('c2'))
        r.add_table(t)

        d = r.to_dict()

        log.debug(str(d))

        self.assertEqual('redfang', d['id'])
        self.assertEqual('redfang.a', d['attributes'][0]['id'])
        self.assertEqual('redfang.a2', d['attributes'][1]['id'])

        self.assertEqual('redfang.pgid', d['plotGroups'][0]['id'])
        self.assertEqual('redfang.pgid.pid', d[
                         'plotGroups'][0]['plots'][0]['id'])
        self.assertEqual('redfang.pgid.pid2', d[
                         'plotGroups'][0]['plots'][1]['id'])

        self.assertEqual('redfang.pgid2', d['plotGroups'][1]['id'])
        self.assertEqual('redfang.pgid2.pid2', d[
                         'plotGroups'][1]['plots'][0]['id'])
        self.assertEqual('redfang.pgid2.pid22', d[
                         'plotGroups'][1]['plots'][1]['id'])

        self.assertEqual('redfang.tabid', d['tables'][0]['id'])
        self.assertEqual('redfang.tabid.c1', d['tables'][
                         0]['columns'][0]['id'])

        self.assertEqual('redfang.tabid2', d['tables'][1]['id'])
        self.assertEqual('redfang.tabid2.c2', d[
                         'tables'][1]['columns'][0]['id'])

        log.info(repr(r))
        self.assertIsNotNone(repr(r))
开发者ID:natechols,项目名称:pbcommand,代码行数:62,代码来源:test_models_report.py

示例2: test_to_dict

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_table [as 别名]
    def test_to_dict(self):
        """
        The id of report sub elements is prepended with the id of the parent
        element when to_dict is called.
        """
        r = Report('redfang')
        a = Attribute('a', 'b')
        a2 = Attribute('a2', 'b2')
        r.add_attribute(a)
        r.add_attribute(a2)

        pg = PlotGroup('pgid')
        pg.add_plot(Plot('pid', 'anImg'))
        pg.add_plot(Plot('pid2', 'anImg2'))
        r.add_plotgroup(pg)

        t = Table('tabid')
        t.add_column(Column('c1'))
        r.add_table(t)

        d = r.to_dict()

        log.debug("\n" + pformat(d))

        self.assertEqual('redfang', d['id'])
        self.assertEqual('redfang.a', d['attributes'][0]['id'])
        self.assertEqual('redfang.a2', d['attributes'][1]['id'])
        self.assertEqual('redfang.pgid', d['plotGroups'][0]['id'])
        self.assertEqual('redfang.pgid.pid', d['plotGroups'][0]['plots'][0]['id'])
        self.assertEqual('redfang.pgid.pid2', d['plotGroups'][0]['plots'][1]['id'])

        self.assertEqual('redfang.tabid', d['tables'][0]['id'])
        self.assertEqual('redfang.tabid.c1', d['tables'][0]['columns'][0]['id'])
开发者ID:mpkocher,项目名称:pbcommand,代码行数:35,代码来源:test_models_report.py

示例3: test_get_table_by_id_with_bad_id

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_table [as 别名]
    def test_get_table_by_id_with_bad_id(self):
        r = Report('redfang')
        t1 = Table('tabid1')
        t1.add_column(Column('c1'))
        r.add_table(t1)

        bad_t = r.get_table_by_id('id_that_does_not_exist')
        self.assertIsNone(bad_t)
开发者ID:natechols,项目名称:pbcommand,代码行数:10,代码来源:test_models_report.py

示例4: test_get_table_by_id

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_table [as 别名]
    def test_get_table_by_id(self):
        r = Report('redfang')
        t1 = Table('tabid1')
        t1.add_column(Column('c1'))
        r.add_table(t1)

        t = r.get_table_by_id('tabid1')
        self.assertEqual(t, t1)
开发者ID:natechols,项目名称:pbcommand,代码行数:10,代码来源:test_models_report.py

示例5: test_get_column_by_id

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_table [as 别名]
    def test_get_column_by_id(self):
        r = Report('redfang')
        t1 = Table('tabid1')
        c1 = Column('c1')
        t1.add_column(c1)
        r.add_table(t1)

        c = r.get_table_by_id('tabid1').get_column_by_id('c1')
        self.assertEqual(c, c1)
开发者ID:natechols,项目名称:pbcommand,代码行数:11,代码来源:test_models_report.py

示例6: test_to_dict_multi

# 需要导入模块: from pbcommand.models.report import Report [as 别名]
# 或者: from pbcommand.models.report.Report import add_table [as 别名]
    def test_to_dict_multi(self):
        """
        Multiple complex elements.
        The id of report sub elements is prepended with the id of the parent
        element when to_dict is called.
        """
        r = Report("redfang")
        a = Attribute("a", "b")
        a2 = Attribute("a2", "b2")
        r.add_attribute(a)
        r.add_attribute(a2)

        pg = PlotGroup("pgid")
        pg.add_plot(Plot("pid", "anImg"))
        pg.add_plot(Plot("pid2", "anImg2"))
        r.add_plotgroup(pg)

        pg = PlotGroup("pgid2")
        pg.add_plot(Plot("pid2", "anImg2"))
        pg.add_plot(Plot("pid22", "anImg22"))
        r.add_plotgroup(pg)

        t = Table("tabid")
        t.add_column(Column("c1"))
        r.add_table(t)

        t = Table("tabid2")
        t.add_column(Column("c2"))
        r.add_table(t)

        d = r.to_dict()

        log.debug(str(d))

        self.assertEqual("redfang", d["id"])
        self.assertEqual("redfang.a", d["attributes"][0]["id"])
        self.assertEqual("redfang.a2", d["attributes"][1]["id"])

        self.assertEqual("redfang.pgid", d["plotGroups"][0]["id"])
        self.assertEqual("redfang.pgid.pid", d["plotGroups"][0]["plots"][0]["id"])
        self.assertEqual("redfang.pgid.pid2", d["plotGroups"][0]["plots"][1]["id"])

        self.assertEqual("redfang.pgid2", d["plotGroups"][1]["id"])
        self.assertEqual("redfang.pgid2.pid2", d["plotGroups"][1]["plots"][0]["id"])
        self.assertEqual("redfang.pgid2.pid22", d["plotGroups"][1]["plots"][1]["id"])

        self.assertEqual("redfang.tabid", d["tables"][0]["id"])
        self.assertEqual("redfang.tabid.c1", d["tables"][0]["columns"][0]["id"])

        self.assertEqual("redfang.tabid2", d["tables"][1]["id"])
        self.assertEqual("redfang.tabid2.c2", d["tables"][1]["columns"][0]["id"])

        log.info(repr(r))
        self.assertIsNotNone(repr(r))
开发者ID:tperelmuter,项目名称:pbcommand,代码行数:56,代码来源:test_models_report.py


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