From 0afd92a2ae488386e310c669b8e8157a5249b527 Mon Sep 17 00:00:00 2001 From: nstarman Date: Thu, 22 Feb 2024 11:47:22 -0500 Subject: [PATCH] WIP test Signed-off-by: nstarman --- sphinx_automodapi/tests/test_automodsumm.py | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/sphinx_automodapi/tests/test_automodsumm.py b/sphinx_automodapi/tests/test_automodsumm.py index fe14e9f..e755139 100644 --- a/sphinx_automodapi/tests/test_automodsumm.py +++ b/sphinx_automodapi/tests/test_automodsumm.py @@ -201,3 +201,39 @@ def test_ams_cython(tmpdir, cython_testpackage): # noqa result = f.read() assert result == ams_cython_expected + + +# ============================================================================= + +sorted_str = """ +Before + +.. automodsumm:: sphinx_automodapi.tests.example_module.classes + :sort: + +And After +""" + +sorted_expected = """\ +.. currentmodule:: sphinx_automodapi.tests.example_module.classes + +.. autosummary:: + + Egg + Spam + +""" + + +def test_sort(tmpdir): + with open(tmpdir.join("index.rst").strpath, "w") as f: + f.write(sorted_str) + + write_api_files_to_tmpdir(tmpdir) + + run_sphinx_in_tmpdir(tmpdir) + + with open(tmpdir.join("index.rst.automodsumm").strpath) as f: + result = f.read() + + assert result == sorted_expected