Ejemplo n.º 1
0
 def test_should_accept_return_statement(self):
     docstring = """
         Title
         
         :return: Here goes the return
     """
     _, _, _, returns = sphinx_doc_parser(docstring)
     self.assertEqual('Here goes the return', returns)
Ejemplo n.º 2
0
 def test_multiline_subtitle(self):
     docstring = """
         Title
         
         Subtitle could be
         multiline.
     """
     _, long_, _, _ = sphinx_doc_parser(docstring)
     self.assertEqual('Subtitle could be\nmultiline.', long_)
Ejemplo n.º 3
0
    def test_it_should_return_params_with_type(self):
        docstring = """
            Title

            :param str name: Here goes the name
        """
        _, _, params, _ = sphinx_doc_parser(docstring)
        self.assertIn('name', params)
        self.assertEqual('str', params['name']['type'])
Ejemplo n.º 4
0
 def test_should_accept_type_statement(self):
     docstring = """
         Title
         
         :param foo: Description goes here
         :type foo: bool
     """
     _, _, param, _ = sphinx_doc_parser(docstring)
     self.assertIn('foo', param)
     self.assertEqual('bool', param['foo']['type'])
Ejemplo n.º 5
0
 def test_param_and_type_works_together(self):
     docstring = """
         Title
         
         Subtitle
         
         :param foo: Description foo goes here
         :type foo: bool
         :param str bar: Description bar goes here
     """
     _, _, params, _ = sphinx_doc_parser(docstring)
     self.assertIn('foo', params)
     self.assertEqual('bool', params['foo']['type'])
     self.assertIn('bar', params)
     self.assertEqual('str', params['bar']['type'])
Ejemplo n.º 6
0
 def test_should_not_fail_when_no_docstring(self):
     docstring = None
     self.assertEqual(("", "", {}, ""), sphinx_doc_parser(docstring))