Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions tests/test_docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
from typing import List

import dargs
import dargs.dargs as dargs_module
from dargs import Argument, ArgumentEncoder, Variant


Expand Down Expand Up @@ -250,17 +250,18 @@ def test_multi_variants(self) -> None:
def test_dpmd(self) -> None:
from .dpmdargs import gen_doc

dargs.RAW_ANCHOR = False
docstr = gen_doc(make_anchor=True, make_link=True)
# print("\n\n"+docstr)
# with open("out.rst", "w") as of:
# print(docstr, file=of)
# now testing raw anchor
dargs.RAW_ANCHOR = True
docstr = gen_doc(make_anchor=True, make_link=True)
# print("\n\n"+docstr)
# with open("outr.rst", "w") as of:
# print(docstr, file=of)
original_raw_anchor = dargs_module.RAW_ANCHOR
try:
dargs_module.RAW_ANCHOR = False
rst_doc = gen_doc(make_anchor=True, make_link=True)
self.assertNotIn(".. raw:: html", rst_doc)

dargs_module.RAW_ANCHOR = True
raw_doc = gen_doc(make_anchor=True, make_link=True)
self.assertIn(".. raw:: html", raw_doc)
finally:
# Avoid leaking module-level configuration into later tests.
dargs_module.RAW_ANCHOR = original_raw_anchor


if __name__ == "__main__":
Expand Down
Loading