From ac70ea056e80d48272e48d6b754375b2eda0d4f9 Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Fri, 31 Jul 2020 23:27:29 -0700 Subject: [PATCH] Fixed incorrect formatting of properties on generated method directives. --- CHANGELOG.rst | 1 + autoapi/templates/python/method.rst | 5 +++++ tests/python/test_pyintegration.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fcc257a..7ed9b4c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,7 @@ Bug Fixes ^^^^^^^^^ * `#219 `: Fixed return types not showing for methods. +* Fixed incorrect formatting of properties on generated method directives. v1.4.0 (2020-06-07) diff --git a/autoapi/templates/python/method.rst b/autoapi/templates/python/method.rst index 4a65387..d73a3ea 100644 --- a/autoapi/templates/python/method.rst +++ b/autoapi/templates/python/method.rst @@ -1,12 +1,17 @@ {%- if obj.display %} {% if sphinx_version >= (2, 1) %} .. method:: {{ obj.short_name }}({{ obj.args }}){% if obj.return_annotation is not none %} -> {{ obj.return_annotation }}{% endif %} + {% if obj.properties %} + {% for property in obj.properties %} :{{ property }}: {% endfor %} + {% else %} + {% endif %} {% else %} .. {{ obj.method_type }}:: {{ obj.short_name }}({{ obj.args }}) + {% endif %} {% if obj.docstring %} diff --git a/tests/python/test_pyintegration.py b/tests/python/test_pyintegration.py index ea73620..ba91581 100644 --- a/tests/python/test_pyintegration.py +++ b/tests/python/test_pyintegration.py @@ -183,7 +183,7 @@ class TestPy3Module(object): example_file = example_handle.read() if sphinx.version_info >= (2, 1): - assert re.search("async_method[^\n]*:async:", example_file) + assert "async async_method" in example_file assert "async example.async_function" in example_file else: assert "async_method" in example_file