Exemplo n.º 1
0
    def test_strip_params_from_docstring(self):
        class AnAPIView(APIView):
            """
            My comments are here

            param -- my param
            """
            pass

        docgen = DocumentationGenerator()
        docstring = docgen.__strip_params_from_docstring__(trim_docstring(AnAPIView.__doc__))

        self.assertEqual("My comments are here<br/>", docstring)
Exemplo n.º 2
0
    def test_strip_params_from_docstring(self):
        class AnAPIView(APIView):
            """
            My comments are here

            param -- my param
            """
            pass

        docgen = DocumentationGenerator()
        docstring = docgen.__strip_params_from_docstring__(trim_docstring(AnAPIView.__doc__))

        self.assertEqual("My comments are here<br/><br/>", docstring)
Exemplo n.º 3
0
    def test_strip_params_from_docstring_multiline(self):
        class TestView(APIView):
            """
            Creates a new user.
            Returns: token - auth token

            email -- e-mail address
            password -- password, optional
            city -- city, optional
            street -- street, optional
            number -- house number, optional
            zip_code -- zip code 10 chars, optional
            phone -- phone number in US format (XXX-XXX-XXXX), optional
            """
            pass

        docgen = DocumentationGenerator()
        docstring = docgen.__strip_params_from_docstring__(TestView.__doc__)
        expected = 'Creates a new user.<br/>Returns: token - auth token<br/>'

        self.assertEqual(expected, docstring)
Exemplo n.º 4
0
    def test_strip_params_from_docstring_multiline(self):
        class TestView(APIView):
            """
            Creates a new user.
            Returns: token - auth token

            email -- e-mail address
            password -- password, optional
            city -- city, optional
            street -- street, optional
            number -- house number, optional
            zip_code -- zip code 10 chars, optional
            phone -- phone number in US format (XXX-XXX-XXXX), optional
            """
            pass

        docgen = DocumentationGenerator()
        docstring = docgen.__strip_params_from_docstring__(TestView.__doc__)
        expected = 'Creates a new user.<br/>Returns: token - auth token<br/>'

        self.assertEqual(expected, docstring)