summaryrefslogtreecommitdiff
path: root/tests/test_ext_autodoc.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-05-28 01:50:24 +0900
committerGitHub <noreply@github.com>2020-05-28 01:50:24 +0900
commitee4c7d3a68734a6cbfc787d9b9e80cd5c260fdcb (patch)
tree129598e466506352ab7f865040052376884c01e8 /tests/test_ext_autodoc.py
parenteb9263b8a083052a35846e5a7c5676abb7b238ca (diff)
parenta5e3b4a43db4c9baf190960f88bb07838e4dc3e2 (diff)
downloadsphinx-git-ee4c7d3a68734a6cbfc787d9b9e80cd5c260fdcb.tar.gz
Merge pull request #7713 from tk0miya/3673_autodoc_sort_by_all
Fix #3673: autodoc: bysource order does not work for a module having __all__
Diffstat (limited to 'tests/test_ext_autodoc.py')
-rw-r--r--tests/test_ext_autodoc.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py
index 9dbc311b8..8a3afa43d 100644
--- a/tests/test_ext_autodoc.py
+++ b/tests/test_ext_autodoc.py
@@ -915,6 +915,40 @@ def test_autodoc_member_order(app):
@pytest.mark.sphinx('html', testroot='ext-autodoc')
+def test_autodoc_module_member_order(app):
+ # case member-order='bysource'
+ options = {"members": 'foo, Bar, baz, qux, Quux, foobar',
+ 'member-order': 'bysource',
+ "undoc-members": True}
+ actual = do_autodoc(app, 'module', 'target.sort_by_all', options)
+ assert list(filter(lambda l: '::' in l, actual)) == [
+ '.. py:module:: target.sort_by_all',
+ '.. py:function:: baz()',
+ '.. py:function:: foo()',
+ '.. py:class:: Bar',
+ '.. py:class:: Quux',
+ '.. py:function:: foobar()',
+ '.. py:function:: qux()',
+ ]
+
+ # case member-order='bysource' and ignore-module-all
+ options = {"members": 'foo, Bar, baz, qux, Quux, foobar',
+ 'member-order': 'bysource',
+ "undoc-members": True,
+ "ignore-module-all": True}
+ actual = do_autodoc(app, 'module', 'target.sort_by_all', options)
+ assert list(filter(lambda l: '::' in l, actual)) == [
+ '.. py:module:: target.sort_by_all',
+ '.. py:function:: foo()',
+ '.. py:class:: Bar',
+ '.. py:function:: baz()',
+ '.. py:function:: qux()',
+ '.. py:class:: Quux',
+ '.. py:function:: foobar()',
+ ]
+
+
+@pytest.mark.sphinx('html', testroot='ext-autodoc')
def test_autodoc_module_scope(app):
app.env.temp_data['autodoc:module'] = 'target'
actual = do_autodoc(app, 'attribute', 'Class.mdocattr')