From 9367977eb27f6cafdb3e13360f7858da1c46847f Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 2 Nov 2021 10:29:17 +1100 Subject: [PATCH] TEST: enable xml doctree tracking --- .pre-commit-config.yaml | 9 +++ tests/conftest.py | 28 ++++++++ tests/test_exercise.py | 40 ++++++++++++ tests/test_exercise/_enum_duplicate_label.xml | 10 +++ tests/test_exercise/_enum_mathtitle_label.xml | 13 ++++ tests/test_exercise/_enum_notitle_label.xml | 10 +++ .../test_exercise/_enum_numref_mathtitle.xml | 34 ++++++++++ tests/test_exercise/_enum_numref_notitle.xml | 34 ++++++++++ .../_enum_numref_placeholders.xml | 64 +++++++++++++++++++ tests/test_exercise/_enum_numref_title.xml | 34 ++++++++++ tests/test_exercise/_enum_ref_mathtitle.xml | 16 +++++ tests/test_exercise/_enum_ref_notitle.xml | 16 +++++ tests/test_exercise/_enum_ref_title.xml | 16 +++++ .../test_exercise/_enum_title_class_label.xml | 10 +++ tests/test_exercise/_enum_title_nolabel.xml | 10 +++ .../test_exercise/_unenum_mathtitle_label.xml | 13 ++++ tests/test_exercise/_unenum_notitle_label.xml | 10 +++ .../_unenum_numref_mathtitle.xml | 34 ++++++++++ .../test_exercise/_unenum_numref_notitle.xml | 34 ++++++++++ tests/test_exercise/_unenum_numref_title.xml | 34 ++++++++++ tests/test_exercise/_unenum_ref_mathtitle.xml | 16 +++++ tests/test_exercise/_unenum_ref_notitle.xml | 16 +++++ tests/test_exercise/_unenum_ref_title.xml | 16 +++++ .../_unenum_title_class_label.xml | 10 +++ tests/test_exercise/_unenum_title_nolabel.xml | 10 +++ tests/test_hiddendirective.py | 36 +++++++++++ tests/test_hiddendirective/_enum_hidden.xml | 4 ++ .../_linked_enum_hidden.xml | 4 ++ .../_linked_unenum_hidden.xml | 4 ++ tests/test_hiddendirective/_unenum_hidden.xml | 4 ++ tests/test_solution.py | 33 ++++++++++ .../test_solution/_linked_duplicate_label.xml | 10 +++ tests/test_solution/_linked_enum.xml | 27 ++++++++ tests/test_solution/_linked_enum_class.xml | 10 +++ tests/test_solution/_linked_missing_arg.xml | 4 ++ tests/test_solution/_linked_ref_enum.xml | 16 +++++ .../_linked_ref_unenum_mathtitle.xml | 16 +++++ .../_linked_ref_unenum_mathtitle2.xml | 16 +++++ .../_linked_ref_unenum_notitle.xml | 16 +++++ .../_linked_ref_unenum_title.xml | 16 +++++ .../test_solution/_linked_ref_wronglabel.xml | 10 +++ .../_linked_unenum_mathtitle.xml | 23 +++++++ .../_linked_unenum_mathtitle2.xml | 23 +++++++ .../test_solution/_linked_unenum_notitle.xml | 20 ++++++ tests/test_solution/_linked_unenum_title.xml | 20 ++++++ .../_linked_wrong_targetlabel.xml | 10 +++ 46 files changed, 859 insertions(+) create mode 100644 tests/test_exercise/_enum_duplicate_label.xml create mode 100644 tests/test_exercise/_enum_mathtitle_label.xml create mode 100644 tests/test_exercise/_enum_notitle_label.xml create mode 100644 tests/test_exercise/_enum_numref_mathtitle.xml create mode 100644 tests/test_exercise/_enum_numref_notitle.xml create mode 100644 tests/test_exercise/_enum_numref_placeholders.xml create mode 100644 tests/test_exercise/_enum_numref_title.xml create mode 100644 tests/test_exercise/_enum_ref_mathtitle.xml create mode 100644 tests/test_exercise/_enum_ref_notitle.xml create mode 100644 tests/test_exercise/_enum_ref_title.xml create mode 100644 tests/test_exercise/_enum_title_class_label.xml create mode 100644 tests/test_exercise/_enum_title_nolabel.xml create mode 100644 tests/test_exercise/_unenum_mathtitle_label.xml create mode 100644 tests/test_exercise/_unenum_notitle_label.xml create mode 100644 tests/test_exercise/_unenum_numref_mathtitle.xml create mode 100644 tests/test_exercise/_unenum_numref_notitle.xml create mode 100644 tests/test_exercise/_unenum_numref_title.xml create mode 100644 tests/test_exercise/_unenum_ref_mathtitle.xml create mode 100644 tests/test_exercise/_unenum_ref_notitle.xml create mode 100644 tests/test_exercise/_unenum_ref_title.xml create mode 100644 tests/test_exercise/_unenum_title_class_label.xml create mode 100644 tests/test_exercise/_unenum_title_nolabel.xml create mode 100644 tests/test_hiddendirective/_enum_hidden.xml create mode 100644 tests/test_hiddendirective/_linked_enum_hidden.xml create mode 100644 tests/test_hiddendirective/_linked_unenum_hidden.xml create mode 100644 tests/test_hiddendirective/_unenum_hidden.xml create mode 100644 tests/test_solution/_linked_duplicate_label.xml create mode 100644 tests/test_solution/_linked_enum.xml create mode 100644 tests/test_solution/_linked_enum_class.xml create mode 100644 tests/test_solution/_linked_missing_arg.xml create mode 100644 tests/test_solution/_linked_ref_enum.xml create mode 100644 tests/test_solution/_linked_ref_unenum_mathtitle.xml create mode 100644 tests/test_solution/_linked_ref_unenum_mathtitle2.xml create mode 100644 tests/test_solution/_linked_ref_unenum_notitle.xml create mode 100644 tests/test_solution/_linked_ref_unenum_title.xml create mode 100644 tests/test_solution/_linked_ref_wronglabel.xml create mode 100644 tests/test_solution/_linked_unenum_mathtitle.xml create mode 100644 tests/test_solution/_linked_unenum_mathtitle2.xml create mode 100644 tests/test_solution/_linked_unenum_notitle.xml create mode 100644 tests/test_solution/_linked_unenum_title.xml create mode 100644 tests/test_solution/_linked_wrong_targetlabel.xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c704ed4..0ace6d0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,15 @@ # Install pre-commit hooks via # pre-commit install +exclude: > + (?x)^( + \.vscode/settings\.json| + docs/source/conf\.py| + tests/test_exercise/.*| + tests/test_solution/.*| + tests/test_hiddendirective/.*| + )$ + repos: - repo: git://github.com/pre-commit/pre-commit-hooks diff --git a/tests/conftest.py b/tests/conftest.py index 9efb7f5..96e6f20 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,7 @@ import shutil import pytest +from pathlib import Path from sphinx.testing.path import path pytest_plugins = "sphinx.testing.fixtures" @@ -22,3 +23,30 @@ def read(app): return app._warning.getvalue().strip() return read + + +@pytest.fixture +def get_sphinx_app_doctree(file_regression): + def read(app, docname="index", resolve=False, regress=False, flatten_outdir=False): + if resolve: + doctree = app.env.get_and_resolve_doctree(docname, app.builder) + extension = ".resolved.xml" + else: + doctree = app.env.get_doctree(docname) + extension = ".xml" + + # convert absolute filenames + for node in doctree.traverse(lambda n: "source" in n): + node["source"] = Path(node["source"]).name + + if flatten_outdir: + docname = docname.split("/")[-1] + + if regress: + file_regression.check( + doctree.pformat(), basename=docname, extension=extension + ) + + return doctree + + return read diff --git a/tests/test_exercise.py b/tests/test_exercise.py index 09ba96c..de9d9c2 100644 --- a/tests/test_exercise.py +++ b/tests/test_exercise.py @@ -28,6 +28,46 @@ def test_exercise(app, idir, file_regression): file_regression.check(str(excs), basename=idir.split(".")[0], extension=".html") +@pytest.mark.sphinx("html", testroot="mybook") +@pytest.mark.parametrize( + "docname", + [ + "_enum_duplicate_label", + "_enum_mathtitle_label", + "_enum_notitle_label", + "_enum_numref_mathtitle", + "_enum_numref_notitle", + "_enum_numref_placeholders", + "_enum_numref_title", + "_enum_ref_mathtitle", + "_enum_ref_notitle", + "_enum_ref_title", + "_enum_title_class_label", + "_enum_title_nolabel", + "_unenum_mathtitle_label", + "_unenum_notitle_label", + "_unenum_numref_mathtitle", + "_unenum_numref_notitle", + "_unenum_numref_title", + "_unenum_ref_mathtitle", + "_unenum_ref_notitle", + "_unenum_ref_title", + "_unenum_title_class_label", + "_unenum_title_nolabel", + ], +) +def test_exercise_doctree(app, docname, file_regression, get_sphinx_app_doctree): + app.build() + docname = "exercise" + "/" + docname + get_sphinx_app_doctree( + app, + docname, + resolve=False, + regress=True, + flatten_outdir=True, # noqa: E501 flatten files "solution/ -> .xml" for convenience + ) + + @pytest.mark.sphinx("html", testroot="mybook") @pytest.mark.parametrize( "idir", diff --git a/tests/test_exercise/_enum_duplicate_label.xml b/tests/test_exercise/_enum_duplicate_label.xml new file mode 100644 index 0000000..ca04e6b --- /dev/null +++ b/tests/test_exercise/_enum_duplicate_label.xml @@ -0,0 +1,10 @@ + +
+ + _enum_duplicate_label + <exercise_node classes="exercise" docname="exercise/_enum_duplicate_label" hidden="False" ids="dup" label="dup" names="dup" title="(duplicate directive 1)" type="exercise"> + <title> + (duplicate directive 1) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_enum_mathtitle_label.xml b/tests/test_exercise/_enum_mathtitle_label.xml new file mode 100644 index 0000000..c4808b7 --- /dev/null +++ b/tests/test_exercise/_enum_mathtitle_label.xml @@ -0,0 +1,13 @@ +<document source="_enum_mathtitle_label.rst"> + <section ids="enum-mathtitle-label" names="_enum_mathtitle_label"> + <title> + _enum_mathtitle_label + <exercise_node classes="exercise" docname="exercise/_enum_mathtitle_label" hidden="False" ids="test-exc-label-math" label="test-exc-label-math" names="test-exc-label-math" title="(Test :math:`\mathbb{R}`)" type="exercise"> + <title> + (Test + <math> + \mathbb{R} + ) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_enum_notitle_label.xml b/tests/test_exercise/_enum_notitle_label.xml new file mode 100644 index 0000000..0f1689a --- /dev/null +++ b/tests/test_exercise/_enum_notitle_label.xml @@ -0,0 +1,10 @@ +<document source="_enum_notitle_label.rst"> + <section ids="enum-notitle-label" names="_enum_notitle_label"> + <title> + _enum_notitle_label + <exercise_node classes="exercise" docname="exercise/_enum_notitle_label" hidden="False" ids="text-exc-notitle" label="text-exc-notitle" names="text-exc-notitle" title="Exercise " type="exercise"> + <title> + Exercise + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_enum_numref_mathtitle.xml b/tests/test_exercise/_enum_numref_mathtitle.xml new file mode 100644 index 0000000..f267851 --- /dev/null +++ b/tests/test_exercise/_enum_numref_mathtitle.xml @@ -0,0 +1,34 @@ +<document source="_enum_numref_mathtitle.rst"> + <section ids="enum-numref-mathtitle" names="_enum_numref_mathtitle"> + <title> + _enum_numref_mathtitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_enum_numref_mathtitle" refdomain="std" refexplicit="False" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + test-exc-label-math + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_enum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text + . + <paragraph> + This is a third reference + <pending_xref refdoc="exercise/_enum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text %s + . + <paragraph> + This is a fourth reference + <pending_xref refdoc="exercise/_enum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {number} + . + <paragraph> + This is a fifth reference + <pending_xref refdoc="exercise/_enum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {name} + . diff --git a/tests/test_exercise/_enum_numref_notitle.xml b/tests/test_exercise/_enum_numref_notitle.xml new file mode 100644 index 0000000..09369b7 --- /dev/null +++ b/tests/test_exercise/_enum_numref_notitle.xml @@ -0,0 +1,34 @@ +<document source="_enum_numref_notitle.rst"> + <section ids="enum-numref-notitle" names="_enum_numref_notitle"> + <title> + _enum_numref_notitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_enum_numref_notitle" refdomain="std" refexplicit="False" reftarget="text-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + text-exc-notitle + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_enum_numref_notitle" refdomain="std" refexplicit="True" reftarget="text-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text + . + <paragraph> + This is a third reference + <pending_xref refdoc="exercise/_enum_numref_notitle" refdomain="std" refexplicit="True" reftarget="text-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text %s + . + <paragraph> + This is a fourth reference + <pending_xref refdoc="exercise/_enum_numref_notitle" refdomain="std" refexplicit="True" reftarget="text-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {number} + . + <paragraph> + This is a fifth reference + <pending_xref refdoc="exercise/_enum_numref_notitle" refdomain="std" refexplicit="True" reftarget="text-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {name} + . diff --git a/tests/test_exercise/_enum_numref_placeholders.xml b/tests/test_exercise/_enum_numref_placeholders.xml new file mode 100644 index 0000000..c505c64 --- /dev/null +++ b/tests/test_exercise/_enum_numref_placeholders.xml @@ -0,0 +1,64 @@ +<document source="_enum_numref_placeholders.rst"> + <section ids="enum-numref-placeholders" names="_enum_numref_placeholders"> + <title> + _enum_numref_placeholders + <paragraph> + This reference does not include math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {number} text %s test {name} + . + <paragraph> + This reference does not include math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {number} text %s test + . + <paragraph> + This reference does not include math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {name} text %s test + . + <paragraph> + This reference does not include math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {name} text {number} test + . + <paragraph> + This reference does not include math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some %s text test + . + <paragraph> + This reference includes math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {number} text %s test {name} + . + <paragraph> + This reference includes math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {number} text %s test + . + <paragraph> + This reference includes math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {name} text %s test + . + <paragraph> + This reference includes math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some {name} text {number} test + . + <paragraph> + This reference includes math + <pending_xref refdoc="exercise/_enum_numref_placeholders" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some %s text test + . diff --git a/tests/test_exercise/_enum_numref_title.xml b/tests/test_exercise/_enum_numref_title.xml new file mode 100644 index 0000000..5abb7c4 --- /dev/null +++ b/tests/test_exercise/_enum_numref_title.xml @@ -0,0 +1,34 @@ +<document source="_enum_numref_title.rst"> + <section ids="enum-numref-title" names="_enum_numref_title"> + <title> + _enum_numref_title + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_enum_numref_title" refdomain="std" refexplicit="False" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + test-exc-label + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_enum_numref_title" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text + . + <paragraph> + This is a third reference + <pending_xref refdoc="exercise/_enum_numref_title" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text %s + . + <paragraph> + This is a fourth reference + <pending_xref refdoc="exercise/_enum_numref_title" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {number} + . + <paragraph> + This is a fifth reference + <pending_xref refdoc="exercise/_enum_numref_title" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {name} + . diff --git a/tests/test_exercise/_enum_ref_mathtitle.xml b/tests/test_exercise/_enum_ref_mathtitle.xml new file mode 100644 index 0000000..b381cb7 --- /dev/null +++ b/tests/test_exercise/_enum_ref_mathtitle.xml @@ -0,0 +1,16 @@ +<document source="_enum_ref_mathtitle.rst"> + <section ids="enum-ref-mathtitle" names="_enum_ref_mathtitle"> + <title> + _enum_ref_mathtitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_enum_ref_mathtitle" refdomain="std" refexplicit="False" reftarget="test-exc-label-math" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + test-exc-label-math + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_enum_ref_mathtitle" refdomain="std" refexplicit="True" reftarget="test-exc-label-math" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text + . diff --git a/tests/test_exercise/_enum_ref_notitle.xml b/tests/test_exercise/_enum_ref_notitle.xml new file mode 100644 index 0000000..954a9b3 --- /dev/null +++ b/tests/test_exercise/_enum_ref_notitle.xml @@ -0,0 +1,16 @@ +<document source="_enum_ref_notitle.rst"> + <section ids="enum-ref-notitle" names="_enum_ref_notitle"> + <title> + _enum_ref_notitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_enum_ref_notitle" refdomain="std" refexplicit="False" reftarget="text-exc-notitle" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + text-exc-notitle + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_enum_ref_notitle" refdomain="std" refexplicit="True" reftarget="text-exc-notitle" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text + . diff --git a/tests/test_exercise/_enum_ref_title.xml b/tests/test_exercise/_enum_ref_title.xml new file mode 100644 index 0000000..24c3e7c --- /dev/null +++ b/tests/test_exercise/_enum_ref_title.xml @@ -0,0 +1,16 @@ +<document source="_enum_ref_title.rst"> + <section ids="enum-ref-title" names="_enum_ref_title"> + <title> + _enum_ref_title + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_enum_ref_title" refdomain="std" refexplicit="False" reftarget="test-exc-label" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + test-exc-label + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_enum_ref_title" refdomain="std" refexplicit="True" reftarget="test-exc-label" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text + . diff --git a/tests/test_exercise/_enum_title_class_label.xml b/tests/test_exercise/_enum_title_class_label.xml new file mode 100644 index 0000000..7fb32cc --- /dev/null +++ b/tests/test_exercise/_enum_title_class_label.xml @@ -0,0 +1,10 @@ +<document source="_enum_title_class_label.rst"> + <section ids="enum-title-class-label" names="_enum_title_class_label"> + <title> + _enum_title_class_label + <exercise_node classes="exercise test-exc" docname="exercise/_enum_title_class_label" hidden="False" ids="test-exc-label" label="test-exc-label" names="test-exc-label" title="(Test exercise directive)" type="exercise"> + <title> + (Test exercise directive) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_enum_title_nolabel.xml b/tests/test_exercise/_enum_title_nolabel.xml new file mode 100644 index 0000000..dd9bb0c --- /dev/null +++ b/tests/test_exercise/_enum_title_nolabel.xml @@ -0,0 +1,10 @@ +<document source="_enum_title_nolabel.rst"> + <section ids="enum-title-nolabel" names="_enum_title_nolabel"> + <title> + _enum_title_nolabel + <exercise_node classes="exercise" docname="exercise/_enum_title_nolabel" hidden="False" ids="exercise/_enum_title_nolabel-exercise-0" label="exercise/_enum_title_nolabel-exercise-0" names="exercise/_enum_title_nolabel-exercise-0" title="(Test exercise directive)" type="exercise"> + <title> + (Test exercise directive) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_unenum_mathtitle_label.xml b/tests/test_exercise/_unenum_mathtitle_label.xml new file mode 100644 index 0000000..86f5d24 --- /dev/null +++ b/tests/test_exercise/_unenum_mathtitle_label.xml @@ -0,0 +1,13 @@ +<document source="_unenum_mathtitle_label.rst"> + <section ids="unenum-mathtitle-label" names="_unenum_mathtitle_label"> + <title> + _unenum_mathtitle_label + <exercise_unenumerable_node classes="exercise" docname="exercise/_unenum_mathtitle_label" hidden="False" ids="unen-exc-label-math" label="unen-exc-label-math" names="unen-exc-label-math" title="(Test :math:`\mathbb{R}`)" type="exercise"> + <title> + (Test + <math> + \mathbb{R} + ) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_unenum_notitle_label.xml b/tests/test_exercise/_unenum_notitle_label.xml new file mode 100644 index 0000000..2b70036 --- /dev/null +++ b/tests/test_exercise/_unenum_notitle_label.xml @@ -0,0 +1,10 @@ +<document source="_unenum_notitle_label.rst"> + <section ids="unenum-notitle-label" names="_unenum_notitle_label"> + <title> + _unenum_notitle_label + <exercise_unenumerable_node classes="exercise" docname="exercise/_unenum_notitle_label" hidden="False" ids="unen-exc-notitle" label="unen-exc-notitle" names="unen-exc-notitle" title="Exercise " type="exercise"> + <title> + Exercise + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_unenum_numref_mathtitle.xml b/tests/test_exercise/_unenum_numref_mathtitle.xml new file mode 100644 index 0000000..c410fe3 --- /dev/null +++ b/tests/test_exercise/_unenum_numref_mathtitle.xml @@ -0,0 +1,34 @@ +<document source="_unenum_numref_mathtitle.rst"> + <section ids="unenum-numref-mathtitle" names="_unenum_numref_mathtitle"> + <title> + _unenum_numref_mathtitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_unenum_numref_mathtitle" refdomain="std" refexplicit="False" reftarget="unen-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + unen-exc-label-math + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_unenum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="unen-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text + . + <paragraph> + This is a third reference + <pending_xref refdoc="exercise/_unenum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="unen-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text %s + . + <paragraph> + This is a fourth reference + <pending_xref refdoc="exercise/_unenum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="unen-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {number} + . + <paragraph> + This is a fifth reference + <pending_xref refdoc="exercise/_unenum_numref_mathtitle" refdomain="std" refexplicit="True" reftarget="unen-exc-label-math" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {name} + . diff --git a/tests/test_exercise/_unenum_numref_notitle.xml b/tests/test_exercise/_unenum_numref_notitle.xml new file mode 100644 index 0000000..7b8753b --- /dev/null +++ b/tests/test_exercise/_unenum_numref_notitle.xml @@ -0,0 +1,34 @@ +<document source="_unenum_numref_notitle.rst"> + <section ids="unenum-numref-notitle" names="_unenum_numref_notitle"> + <title> + _unenum_numref_notitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_unenum_numref_notitle" refdomain="std" refexplicit="False" reftarget="unen-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + unen-exc-notitle + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_unenum_numref_notitle" refdomain="std" refexplicit="True" reftarget="unen-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text + . + <paragraph> + This is a third reference + <pending_xref refdoc="exercise/_unenum_numref_notitle" refdomain="std" refexplicit="True" reftarget="unen-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text %s + . + <paragraph> + This is a fourth reference + <pending_xref refdoc="exercise/_unenum_numref_notitle" refdomain="std" refexplicit="True" reftarget="unen-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {number} + . + <paragraph> + This is a fifth reference + <pending_xref refdoc="exercise/_unenum_numref_notitle" refdomain="std" refexplicit="True" reftarget="unen-exc-notitle" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {name} + . diff --git a/tests/test_exercise/_unenum_numref_title.xml b/tests/test_exercise/_unenum_numref_title.xml new file mode 100644 index 0000000..68d6fb3 --- /dev/null +++ b/tests/test_exercise/_unenum_numref_title.xml @@ -0,0 +1,34 @@ +<document source="_unenum_numref_title.rst"> + <section ids="unenum-numref-title" names="_unenum_numref_title"> + <title> + _unenum_numref_title + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_unenum_numref_title" refdomain="std" refexplicit="False" reftarget="unen-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + unen-exc-label + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_unenum_numref_title" refdomain="std" refexplicit="True" reftarget="unen-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text + . + <paragraph> + This is a third reference + <pending_xref refdoc="exercise/_unenum_numref_title" refdomain="std" refexplicit="True" reftarget="unen-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text %s + . + <paragraph> + This is a fourth reference + <pending_xref refdoc="exercise/_unenum_numref_title" refdomain="std" refexplicit="True" reftarget="unen-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {number} + . + <paragraph> + This is a fifth reference + <pending_xref refdoc="exercise/_unenum_numref_title" refdomain="std" refexplicit="True" reftarget="unen-exc-label" reftype="numref" refwarn="True"> + <literal classes="xref std std-numref"> + some text {name} + . diff --git a/tests/test_exercise/_unenum_ref_mathtitle.xml b/tests/test_exercise/_unenum_ref_mathtitle.xml new file mode 100644 index 0000000..2a982ab --- /dev/null +++ b/tests/test_exercise/_unenum_ref_mathtitle.xml @@ -0,0 +1,16 @@ +<document source="_unenum_ref_mathtitle.rst"> + <section ids="unenum-ref-mathtitle" names="_unenum_ref_mathtitle"> + <title> + _unenum_ref_mathtitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_unenum_ref_mathtitle" refdomain="std" refexplicit="False" reftarget="unen-exc-label-math" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + unen-exc-label-math + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_unenum_ref_mathtitle" refdomain="std" refexplicit="True" reftarget="unen-exc-label-math" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text + . diff --git a/tests/test_exercise/_unenum_ref_notitle.xml b/tests/test_exercise/_unenum_ref_notitle.xml new file mode 100644 index 0000000..04ef7e6 --- /dev/null +++ b/tests/test_exercise/_unenum_ref_notitle.xml @@ -0,0 +1,16 @@ +<document source="_unenum_ref_notitle.rst"> + <section ids="unenum-ref-notitle" names="_unenum_ref_notitle"> + <title> + _unenum_ref_notitle + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_unenum_ref_notitle" refdomain="std" refexplicit="False" reftarget="unen-exc-notitle" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + unen-exc-notitle + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_unenum_ref_notitle" refdomain="std" refexplicit="True" reftarget="unen-exc-notitle" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text + . diff --git a/tests/test_exercise/_unenum_ref_title.xml b/tests/test_exercise/_unenum_ref_title.xml new file mode 100644 index 0000000..8147e1b --- /dev/null +++ b/tests/test_exercise/_unenum_ref_title.xml @@ -0,0 +1,16 @@ +<document source="_unenum_ref_title.rst"> + <section ids="unenum-ref-title" names="_unenum_ref_title"> + <title> + _unenum_ref_title + <paragraph> + This is a reference + <pending_xref refdoc="exercise/_unenum_ref_title" refdomain="std" refexplicit="False" reftarget="unen-exc-label" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + unen-exc-label + . + <paragraph> + This is a second reference + <pending_xref refdoc="exercise/_unenum_ref_title" refdomain="std" refexplicit="True" reftarget="unen-exc-label" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + some text + . diff --git a/tests/test_exercise/_unenum_title_class_label.xml b/tests/test_exercise/_unenum_title_class_label.xml new file mode 100644 index 0000000..ae0b2a4 --- /dev/null +++ b/tests/test_exercise/_unenum_title_class_label.xml @@ -0,0 +1,10 @@ +<document source="_unenum_title_class_label.rst"> + <section ids="unenum-title-class-label" names="_unenum_title_class_label"> + <title> + _unenum_title_class_label + <exercise_unenumerable_node classes="exercise unen-exc" docname="exercise/_unenum_title_class_label" hidden="False" ids="unen-exc-label" label="unen-exc-label" names="unen-exc-label" title="(Test exercise directive)" type="exercise"> + <title> + (Test exercise directive) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_exercise/_unenum_title_nolabel.xml b/tests/test_exercise/_unenum_title_nolabel.xml new file mode 100644 index 0000000..2b3b8ed --- /dev/null +++ b/tests/test_exercise/_unenum_title_nolabel.xml @@ -0,0 +1,10 @@ +<document source="_unenum_title_nolabel.rst"> + <section ids="unenum-title-nolabel" names="_unenum_title_nolabel"> + <title> + _unenum_title_nolabel + <exercise_unenumerable_node classes="exercise" docname="exercise/_unenum_title_nolabel" hidden="False" ids="exercise/_unenum_title_nolabel-exercise-0" label="exercise/_unenum_title_nolabel-exercise-0" names="exercise/_unenum_title_nolabel-exercise-0" title="(Test exercise directive)" type="exercise"> + <title> + (Test exercise directive) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. diff --git a/tests/test_hiddendirective.py b/tests/test_hiddendirective.py index 9340396..eefe28b 100644 --- a/tests/test_hiddendirective.py +++ b/tests/test_hiddendirective.py @@ -35,6 +35,24 @@ def test_hidden_exercise(app, idir, file_regression): assert len(exercise) == 0 +@pytest.mark.sphinx("html", testroot="hiddendirectives") +@pytest.mark.parametrize( + "docname", + [ + "_enum_hidden", + "_unenum_hidden", + ], +) +def test_hidden_exercise_doctree(app, docname, file_regression, get_sphinx_app_doctree): + app.build() + get_sphinx_app_doctree( + app, + docname, + resolve=False, + regress=True, + ) + + @pytest.mark.sphinx("html", testroot="hiddendirectives") @pytest.mark.parametrize( "idir", @@ -53,3 +71,21 @@ def test_hidden_solution(app, idir, file_regression): soup = BeautifulSoup(path_to_directive.read_text(encoding="utf8"), "html.parser") solution = soup.select("div.solution") assert len(solution) == 0 + + +@pytest.mark.sphinx("html", testroot="hiddendirectives") +@pytest.mark.parametrize( + "docname", + [ + "_linked_enum_hidden", + "_linked_unenum_hidden", + ], +) +def test_hidden_solution_doctree(app, docname, file_regression, get_sphinx_app_doctree): + app.build() + get_sphinx_app_doctree( + app, + docname, + resolve=False, + regress=True, + ) diff --git a/tests/test_hiddendirective/_enum_hidden.xml b/tests/test_hiddendirective/_enum_hidden.xml new file mode 100644 index 0000000..25dbe70 --- /dev/null +++ b/tests/test_hiddendirective/_enum_hidden.xml @@ -0,0 +1,4 @@ +<document source="_enum_hidden.rst"> + <section ids="enum-hidden" names="_enum_hidden"> + <title> + _enum_hidden diff --git a/tests/test_hiddendirective/_linked_enum_hidden.xml b/tests/test_hiddendirective/_linked_enum_hidden.xml new file mode 100644 index 0000000..6a6f2b2 --- /dev/null +++ b/tests/test_hiddendirective/_linked_enum_hidden.xml @@ -0,0 +1,4 @@ +<document source="_linked_enum_hidden.rst"> + <section ids="linked-enum-hidden" names="_linked_enum_hidden"> + <title> + _linked_enum_hidden diff --git a/tests/test_hiddendirective/_linked_unenum_hidden.xml b/tests/test_hiddendirective/_linked_unenum_hidden.xml new file mode 100644 index 0000000..86838b9 --- /dev/null +++ b/tests/test_hiddendirective/_linked_unenum_hidden.xml @@ -0,0 +1,4 @@ +<document source="_linked_unenum_hidden.rst"> + <section ids="linked-unenum-hidden" names="_linked_unenum_hidden"> + <title> + _linked_unenum_hidden diff --git a/tests/test_hiddendirective/_unenum_hidden.xml b/tests/test_hiddendirective/_unenum_hidden.xml new file mode 100644 index 0000000..dec2fb2 --- /dev/null +++ b/tests/test_hiddendirective/_unenum_hidden.xml @@ -0,0 +1,4 @@ +<document source="_unenum_hidden.rst"> + <section ids="unenum-hidden" names="_unenum_hidden"> + <title> + _unenum_hidden diff --git a/tests/test_solution.py b/tests/test_solution.py index 3c83e9a..7d8a409 100644 --- a/tests/test_solution.py +++ b/tests/test_solution.py @@ -30,6 +30,39 @@ def test_solution(app, idir, file_regression): file_regression.check(str(sol), basename=idir.split(".")[0], extension=".html") +@pytest.mark.sphinx("html", testroot="mybook") +@pytest.mark.parametrize( + "docname", + [ + "_linked_duplicate_label", + "_linked_enum", + "_linked_enum_class", + "_linked_missing_arg", + "_linked_ref_enum", + "_linked_ref_unenum_mathtitle", + "_linked_ref_unenum_mathtitle2", + "_linked_ref_unenum_notitle", + "_linked_ref_unenum_title", + "_linked_ref_wronglabel", + "_linked_unenum_mathtitle", + "_linked_unenum_mathtitle2", + "_linked_unenum_notitle", + "_linked_unenum_title", + "_linked_wrong_targetlabel", + ], +) +def test_solution_doctree(app, docname, file_regression, get_sphinx_app_doctree): + app.build() + docname = "solution" + "/" + docname + get_sphinx_app_doctree( + app, + docname, + resolve=False, + regress=True, + flatten_outdir=True, # noqa: E501 flatten files "solution/<file> -> <file>.xml" for convenience + ) + + @pytest.mark.sphinx("html", testroot="mybook") @pytest.mark.parametrize( "idir", diff --git a/tests/test_solution/_linked_duplicate_label.xml b/tests/test_solution/_linked_duplicate_label.xml new file mode 100644 index 0000000..7bd1f24 --- /dev/null +++ b/tests/test_solution/_linked_duplicate_label.xml @@ -0,0 +1,10 @@ +<document source="_linked_duplicate_label.rst"> + <section ids="linked-duplicate-label" names="_linked_duplicate_label"> + <title> + _linked_duplicate_label + <solution_node classes="solution" docname="solution/_linked_duplicate_label" hidden="False" ids="sol-duplicate-label" label="sol-duplicate-label" names="sol-duplicate-label" target_label="ex-nonumber-notitle" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/tests/test_solution/_linked_enum.xml b/tests/test_solution/_linked_enum.xml new file mode 100644 index 0000000..0b901e2 --- /dev/null +++ b/tests/test_solution/_linked_enum.xml @@ -0,0 +1,27 @@ +<document source="_linked_enum.rst"> + <section ids="linked-enum" names="_linked_enum"> + <title> + _linked_enum + <exercise_node classes="exercise" docname="solution/_linked_enum" hidden="False" ids="ex-number" label="ex-number" names="ex-number" title="(This is a title)" type="exercise"> + <title> + (This is a title) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + <paragraph> + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + <paragraph> + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <solution_node classes="solution" docname="solution/_linked_enum" hidden="False" ids="sol-number" label="sol-number" names="sol-number" target_label="ex-number" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + <math_block docname="solution/_linked_enum" label="True" nowrap="False" number="True" xml:space="preserve"> + P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t) + <paragraph> + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <target refid="equation-ex-math"> + <math_block docname="solution/_linked_enum" ids="equation-ex-math" label="ex-math" nowrap="False" number="1" xml:space="preserve"> + P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t) diff --git a/tests/test_solution/_linked_enum_class.xml b/tests/test_solution/_linked_enum_class.xml new file mode 100644 index 0000000..750c0dc --- /dev/null +++ b/tests/test_solution/_linked_enum_class.xml @@ -0,0 +1,10 @@ +<document source="_linked_enum_class.rst"> + <section ids="linked-enum-class" names="_linked_enum_class"> + <title> + _linked_enum_class + <solution_node classes="solution test-solution" docname="solution/_linked_enum_class" hidden="False" ids="solution-label" label="solution-label" names="solution-label" target_label="ex-number" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/tests/test_solution/_linked_missing_arg.xml b/tests/test_solution/_linked_missing_arg.xml new file mode 100644 index 0000000..6ecb8d7 --- /dev/null +++ b/tests/test_solution/_linked_missing_arg.xml @@ -0,0 +1,4 @@ +<document source="_linked_missing_arg.rst"> + <section ids="linked-missing-arg" names="_linked_missing_arg"> + <title> + _linked_missing_arg diff --git a/tests/test_solution/_linked_ref_enum.xml b/tests/test_solution/_linked_ref_enum.xml new file mode 100644 index 0000000..a3bf5c6 --- /dev/null +++ b/tests/test_solution/_linked_ref_enum.xml @@ -0,0 +1,16 @@ +<document source="_linked_ref_enum.rst"> + <section ids="linked-ref-enum" names="_linked_ref_enum"> + <title> + _linked_ref_enum + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_enum" refdomain="std" refexplicit="False" reftarget="sol-number" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + sol-number + . + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_enum" refdomain="std" refexplicit="True" reftarget="sol-number" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + simple solution with number + . diff --git a/tests/test_solution/_linked_ref_unenum_mathtitle.xml b/tests/test_solution/_linked_ref_unenum_mathtitle.xml new file mode 100644 index 0000000..9cafd2a --- /dev/null +++ b/tests/test_solution/_linked_ref_unenum_mathtitle.xml @@ -0,0 +1,16 @@ +<document source="_linked_ref_unenum_mathtitle.rst"> + <section ids="linked-ref-unenum-mathtitle" names="_linked_ref_unenum_mathtitle"> + <title> + _linked_ref_unenum_mathtitle + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_mathtitle" refdomain="std" refexplicit="False" reftarget="sol-nonumber-title-math" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + sol-nonumber-title-math + . + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_mathtitle" refdomain="std" refexplicit="True" reftarget="sol-nonumber-title-math" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + exercise with nonumber but with inline math title + . diff --git a/tests/test_solution/_linked_ref_unenum_mathtitle2.xml b/tests/test_solution/_linked_ref_unenum_mathtitle2.xml new file mode 100644 index 0000000..6b2527e --- /dev/null +++ b/tests/test_solution/_linked_ref_unenum_mathtitle2.xml @@ -0,0 +1,16 @@ +<document source="_linked_ref_unenum_mathtitle2.rst"> + <section ids="linked-ref-unenum-mathtitle2" names="_linked_ref_unenum_mathtitle2"> + <title> + _linked_ref_unenum_mathtitle2 + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_mathtitle2" refdomain="std" refexplicit="False" reftarget="sol-nonumber-title-math2" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + sol-nonumber-title-math2 + . + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_mathtitle2" refdomain="std" refexplicit="True" reftarget="sol-nonumber-title-math2" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + exercise with nonumber but with inline math title ex2 + . diff --git a/tests/test_solution/_linked_ref_unenum_notitle.xml b/tests/test_solution/_linked_ref_unenum_notitle.xml new file mode 100644 index 0000000..2f0f6a3 --- /dev/null +++ b/tests/test_solution/_linked_ref_unenum_notitle.xml @@ -0,0 +1,16 @@ +<document source="_linked_ref_unenum_notitle.rst"> + <section ids="linked-ref-unenum-notitle" names="_linked_ref_unenum_notitle"> + <title> + _linked_ref_unenum_notitle + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_notitle" refdomain="std" refexplicit="False" reftarget="sol-nonumber-notitle" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + sol-nonumber-notitle + . + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_notitle" refdomain="std" refexplicit="True" reftarget="sol-nonumber-notitle" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + ex with nonumber and notitle + . diff --git a/tests/test_solution/_linked_ref_unenum_title.xml b/tests/test_solution/_linked_ref_unenum_title.xml new file mode 100644 index 0000000..cc67147 --- /dev/null +++ b/tests/test_solution/_linked_ref_unenum_title.xml @@ -0,0 +1,16 @@ +<document source="_linked_ref_unenum_title.rst"> + <section ids="linked-ref-unenum-title" names="_linked_ref_unenum_title"> + <title> + _linked_ref_unenum_title + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_title" refdomain="std" refexplicit="False" reftarget="sol-nonumber-title" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + sol-nonumber-title + . + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_unenum_title" refdomain="std" refexplicit="True" reftarget="sol-nonumber-title" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + exercise with nonumber but with title + . diff --git a/tests/test_solution/_linked_ref_wronglabel.xml b/tests/test_solution/_linked_ref_wronglabel.xml new file mode 100644 index 0000000..4f54b84 --- /dev/null +++ b/tests/test_solution/_linked_ref_wronglabel.xml @@ -0,0 +1,10 @@ +<document source="_linked_ref_wronglabel.rst"> + <section ids="linked-ref-wronglabel" names="_linked_ref_wronglabel"> + <title> + _linked_ref_wronglabel + <paragraph> + referencing: + <pending_xref refdoc="solution/_linked_ref_wronglabel" refdomain="std" refexplicit="False" reftarget="foobar" reftype="ref" refwarn="True"> + <inline classes="xref std std-ref"> + foobar + . diff --git a/tests/test_solution/_linked_unenum_mathtitle.xml b/tests/test_solution/_linked_unenum_mathtitle.xml new file mode 100644 index 0000000..1b8e646 --- /dev/null +++ b/tests/test_solution/_linked_unenum_mathtitle.xml @@ -0,0 +1,23 @@ +<document source="_linked_unenum_mathtitle.rst"> + <section ids="linked-unenum-mathtitle" names="_linked_unenum_mathtitle"> + <title> + _linked_unenum_mathtitle + <exercise_unenumerable_node classes="exercise" docname="solution/_linked_unenum_mathtitle" hidden="False" ids="ex-nonumber-title-math" label="ex-nonumber-title-math" names="ex-nonumber-title-math" title="(This is a title :math:`\mathbb{R}`)" type="exercise"> + <title> + (This is a title + <math> + \mathbb{R} + ) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + <paragraph> + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + <paragraph> + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <solution_node classes="solution" docname="solution/_linked_unenum_mathtitle" hidden="False" ids="sol-nonumber-title-math" label="sol-nonumber-title-math" names="sol-nonumber-title-math" target_label="ex-nonumber-title-math" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/tests/test_solution/_linked_unenum_mathtitle2.xml b/tests/test_solution/_linked_unenum_mathtitle2.xml new file mode 100644 index 0000000..faf7301 --- /dev/null +++ b/tests/test_solution/_linked_unenum_mathtitle2.xml @@ -0,0 +1,23 @@ +<document source="_linked_unenum_mathtitle2.rst"> + <section ids="linked-unenum-mathtitle2" names="_linked_unenum_mathtitle2"> + <title> + _linked_unenum_mathtitle2 + <exercise_unenumerable_node classes="exercise" docname="solution/_linked_unenum_mathtitle2" hidden="False" ids="ex-nonumber-title-math2" label="ex-nonumber-title-math2" names="ex-nonumber-title-math2" title="(This is a title :math:`P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t)`)" type="exercise"> + <title> + (This is a title + <math> + P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t) + ) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + <paragraph> + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + <paragraph> + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <solution_node classes="solution" docname="solution/_linked_unenum_mathtitle2" hidden="False" ids="sol-nonumber-title-math2" label="sol-nonumber-title-math2" names="sol-nonumber-title-math2" target_label="ex-nonumber-title-math2" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/tests/test_solution/_linked_unenum_notitle.xml b/tests/test_solution/_linked_unenum_notitle.xml new file mode 100644 index 0000000..a73e021 --- /dev/null +++ b/tests/test_solution/_linked_unenum_notitle.xml @@ -0,0 +1,20 @@ +<document source="_linked_unenum_notitle.rst"> + <section ids="linked-unenum-notitle" names="_linked_unenum_notitle"> + <title> + _linked_unenum_notitle + <exercise_unenumerable_node classes="exercise" docname="solution/_linked_unenum_notitle" hidden="False" ids="ex-nonumber-notitle" label="ex-nonumber-notitle" names="ex-nonumber-notitle" title="Exercise " type="exercise"> + <title> + Exercise + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + <paragraph> + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + <paragraph> + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <solution_node classes="solution" docname="solution/_linked_unenum_notitle" hidden="False" ids="sol-nonumber-notitle" label="sol-nonumber-notitle" names="sol-nonumber-notitle" target_label="ex-nonumber-notitle" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/tests/test_solution/_linked_unenum_title.xml b/tests/test_solution/_linked_unenum_title.xml new file mode 100644 index 0000000..6fff58f --- /dev/null +++ b/tests/test_solution/_linked_unenum_title.xml @@ -0,0 +1,20 @@ +<document source="_linked_unenum_title.rst"> + <section ids="linked-unenum-title" names="_linked_unenum_title"> + <title> + _linked_unenum_title + <exercise_unenumerable_node classes="exercise" docname="solution/_linked_unenum_title" hidden="False" ids="ex-nonumber-title" label="ex-nonumber-title" names="ex-nonumber-title" title="(This is a title)" type="exercise"> + <title> + (This is a title) + <section ids="exercise-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. + <paragraph> + Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. + <paragraph> + Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + <solution_node classes="solution" docname="solution/_linked_unenum_title" hidden="False" ids="sol-nonumber-title" label="sol-nonumber-title" names="sol-nonumber-title" target_label="ex-nonumber-title" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. diff --git a/tests/test_solution/_linked_wrong_targetlabel.xml b/tests/test_solution/_linked_wrong_targetlabel.xml new file mode 100644 index 0000000..9a36e31 --- /dev/null +++ b/tests/test_solution/_linked_wrong_targetlabel.xml @@ -0,0 +1,10 @@ +<document source="_linked_wrong_targetlabel.rst"> + <section ids="linked-wrong-targetlabel" names="_linked_wrong_targetlabel"> + <title> + _linked_wrong_targetlabel + <solution_node classes="solution" docname="solution/_linked_wrong_targetlabel" hidden="False" ids="solution/_linked_wrong_targetlabel-solution-0" label="solution/_linked_wrong_targetlabel-solution-0" names="solution/_linked_wrong_targetlabel-solution-0" target_label="wrong-ex-label" title="Solution to " type="solution"> + <title> + Solution to + <section ids="solution-content"> + <paragraph> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.