Esempio n. 1
0
 def generateDoc(self, doc):
     para = rst.Paragraph('\n')
     doc.add_child(para)
     sec = rst.Section('Test Case : ' + str(self.info['index']), 2)
     doc.add_child(sec)
     desc = self.info['description'][0].lstrip()
     desc = desc.rstrip()
     para = rst.Paragraph('**' + desc + '**\n\n')
     doc.add_child(para)
     tbl = rst.Table(header=['Test Execution Steps'])
     for line in self.info['steps']:
         row = []
         row.append(line)
         tbl.add_item(row)
     doc.add_child(tbl)
     para = rst.Paragraph('\n**Expected Results**\n')
     doc.add_child(para)
     bList = rst.Bulletlist()
     for line in self.info['expect']:
         bList.add_item(line)
     doc.add_child(bList)
     para = rst.Paragraph('\n**Actual Results**\n')
     doc.add_child(para)
     para = rst.Paragraph('    PASS\n')
     doc.add_child(para)
Esempio n. 2
0
 def test_paragraph(self):
     "test the paragraph in the document"
     doc = rst.Document(u(""))
     para = rst.Paragraph(u('This is a paragraph.'))
     doc.add_child(para)
     text = doc.get_rst()
     actual_text = u('\n\n\n\nThis is a paragraph.\n\n')
     self.assertEqual(text, actual_text)
Esempio n. 3
0
def main():
    doc = rst.Document('Title of the report')
    para = rst.Paragraph('Just another paragraph. We need few more of these.')
    doc.add_child(para)
    sec = rst.Section('Another', 2)
    doc.add_child(sec)
    para = rst.Paragraph('Can we do this? Yes we can.')
    doc.add_child(para)

    blt = rst.Orderedlist()
    blt.add_item('Red Hat')
    blt.add_item('Fedora')
    blt.add_item('Debian')

    doc.add_child(blt)

    blt = rst.Bulletlist()
    blt.add_item('Python')
    blt.add_item('C')
    blt.add_item('C++')
    blt.add_item('Lisp')

    doc.add_child(blt)



    sec2 = rst.Section('Why Python is awesome?', 2)
    sec.add_child(sec2)

    tbl = rst.Table('My friends', ['Name', 'Major Project'])
    tbl.add_item(('Ramki', 'Python'))
    tbl.add_item(('Pradeepto', 'Kde'))
    tbl.add_item(('Nicubunu', 'Fedora'))
    doc.add_child(tbl)

    print doc.get_rst()
Esempio n. 4
0
    def output(self, results):
        # Prepare the rst
        doc = rst.Document('Metrics for the code "%s"' %
                           self.prettify(results[CODE_PATH]))
        doc.add_child(
            rst.Paragraph('*Date of the report:* %s\n\n' %
                          self.prettify(results[REPORT_DATE])))

        table = rst.Table('Metrics', ['Name', 'Value'])
        for k, v in results.items():
            if k in [CODE_PATH, REPORT_DATE]:
                continue  # Skip some fields
            table.add_item((k, self.prettify(v)))
        doc.add_child(table)

        # Write it
        os.makedirs(os.path.dirname(self.path), exist_ok=True)
        with open('%s' % self.path, 'w') as file:
            file.write(doc.get_rst())