From 7dd822eef4fef4636cc0744340326e40e49e7550 Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Mon, 6 Aug 2018 15:02:01 -0700 Subject: [PATCH] Can still link to public items in private modules --- autoapi/templates/python/module.rst | 4 +--- tests/pypackageexample/example/_private_module.py | 9 ++++++--- tests/test_integration.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/autoapi/templates/python/module.rst b/autoapi/templates/python/module.rst index 81d77d3..eeb1c3b 100644 --- a/autoapi/templates/python/module.rst +++ b/autoapi/templates/python/module.rst @@ -1,5 +1,4 @@ -{% if not obj.display %}:orphan: -{% else %} +{% if not obj.display %}:orphan:{% endif %} {% if obj.docstring or obj.subpackages or obj.submodules or obj.children %} :mod:`{{ obj.name }}` ======={{ "=" * obj.name|length }} @@ -86,4 +85,3 @@ Functions {% endif %}{% endblock %} {% endif %} -{% endif %} diff --git a/tests/pypackageexample/example/_private_module.py b/tests/pypackageexample/example/_private_module.py index cd08cb5..537db64 100644 --- a/tests/pypackageexample/example/_private_module.py +++ b/tests/pypackageexample/example/_private_module.py @@ -1,3 +1,6 @@ -def _private_function(): - """This is private.""" - return 5 +class PrivateClass(object): + """A private class with public facing methods.""" + + def public_method(): + """This is public.""" + return 5 diff --git a/tests/test_integration.py b/tests/test_integration.py index 0ffea3b..ef308aa 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -280,7 +280,7 @@ class PythonTests(LanguageIntegrationTests): with io.open(private_path, encoding='utf8') as private_handle: private_file = private_handle.read() - self.assertNotIn('private', private_file) + self.assertIn('public_method', private_file) class DotNetTests(LanguageIntegrationTests):