コード例 #1
0
ファイル: table_test.py プロジェクト: annegentle/wadl2rst
 def test_create_formatted_table(self):
     output = table.create_table(self.columns, self.rows)
     self.assertIn("+--------------------------+-------------------------+-------------------------+", output)
     self.assertIn("|123                       |123                      |123                      |", output)
     self.assertIn("+==========================+=========================+=========================+", output)
     self.assertIn("|abc                       |abc                      |abc                      |", output)
     self.assertIn("+--------------------------+-------------------------+-------------------------+", output)
コード例 #2
0
    def to_table(self, style=None):
        """ Create a table from these params """

        columns = ["Name", "Type", "Description"]
        rows = [item.get_table_row() for item in self.get_params(style)]

        if len(rows) > 0:
            return table.create_table(columns, rows)
        else:
            return None
コード例 #3
0
    def to_rst(self):
        """ Return the rst representation of this tag and its children. """

        trs = self.find('tr')
        columns = [child.to_rst() for child in trs[0].children]
        rows = [[child.to_rst() for child in tr.children] for tr in trs[1:]]
        output = table.create_table(columns,rows)

        caption_nodes = self.find('caption')
        if len(caption_nodes) > 0:
            caption_text = caption_nodes[0].to_rst()
            output = ".. table:: " + caption_text + "\n\n" + text.indent(output)

        return output
コード例 #4
0
    def to_rst(self):
        """ Return the rst representation of this tag and its children. """

        trs = self.find('tr')
        columns = [child.to_rst() for child in trs[0].children]
        rows = [[child.to_rst() for child in tr.children] for tr in trs[1:]]
        output = table.create_table(columns, rows)

        caption_nodes = self.find('caption')
        if len(caption_nodes) > 0:
            caption_text = caption_nodes[0].to_rst()
            output = ".. table:: " + caption_text + "\n\n" + text.indent(
                output)

        return output
コード例 #5
0
 def test_create_formatted_table(self):
     output = table.create_table(self.columns, self.rows)
     self.assertIn(
         "+--------------------------+-------------------------+-------------------------+",
         output)
     self.assertIn(
         "|123                       |123                      |123                      |",
         output)
     self.assertIn(
         "+==========================+=========================+=========================+",
         output)
     self.assertIn(
         "|abc                       |abc                      |abc                      |",
         output)
     self.assertIn(
         "+--------------------------+-------------------------+-------------------------+",
         output)
コード例 #6
0
 def get_responses_table(self, responses):
     columns = ["Response Code", "Name", "Description"]
     return table.create_table(columns, responses)
コード例 #7
0
 def get_responses_table(self, responses):
     columns = ["Response Code", "Name", "Description"]
     return table.create_table(columns, responses)