From d5c1f0d8fc8b1de006297f0cbbc3c593f390b475 Mon Sep 17 00:00:00 2001 From: njzjz-bot Date: Mon, 24 Aug 2026 03:10:37 +0800 Subject: [PATCH] test: toggle the real raw-anchor setting Coding-Agent: Codex Codex-Version: codex-cli 0.149.0 Model: gpt-5.6-sol Reasoning-Effort: xhigh --- tests/test_docgen.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/test_docgen.py b/tests/test_docgen.py index e004779..472fad0 100644 --- a/tests/test_docgen.py +++ b/tests/test_docgen.py @@ -4,7 +4,7 @@ import unittest from typing import List -import dargs +import dargs.dargs as dargs_module from dargs import Argument, ArgumentEncoder, Variant @@ -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__":