Example #1
0
    def test_get_from_str(self):
        d = Doc.get_from_str(self.doc1)
        self.assertEqual("Computes a cumulative percent sum.", d.one_line)
        self.assertEqual(
            """A cumulative percent sum is computed by sequentially stepping through the
column values and keeping track of the current percentage of the total sum
accounted for at the current value.""", d.extended)
Example #2
0
 def doc_to_rst(doc):
     """Create a Doc object if not already a Doc"""
     return doc if isinstance(doc, Doc) else Doc.get_from_str(doc)
Example #3
0
 def doc_to_rst(doc):
     """Create a Doc object if not already a Doc"""
     return doc if isinstance(doc, Doc) else Doc.get_from_str(doc)
Example #4
0
def get_doc(json_schema):
    doc = json_schema.get('doc', {})
    title = doc.get('title', '<Missing Doc>').strip()
    description = (doc.get('description', '') or '').lstrip()
    examples = (doc.get('examples', {}) or {}).get('python', '').lstrip()
    return Doc(title, description, examples)
Example #5
0
    def test_get_from_str(self):
        d = Doc.get_from_str(self.doc1)
        self.assertEqual("Computes a cumulative percent sum.", d.one_line)
        self.assertEqual("""A cumulative percent sum is computed by sequentially stepping through the
column values and keeping track of the current percentage of the total sum
accounted for at the current value.""", d.extended)