Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09b9d59

Browse files
committed
this is clearer
1 parent 967c079 commit 09b9d59

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/linklint/rsthelp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ def parse_rst(content: str) -> nodes.document:
3838
with in_tempdir():
3939
doctree = run_sphinx(content, buildername="dummy", extensions=[])
4040
fix_node_lines(doctree)
41-
save_test_doctree(doctree)
41+
if SAVE_INTERMEDIATE:
42+
save_test_doctree(doctree)
4243
return doctree
4344

4445

4546
def save_test_doctree(doctree: nodes.document) -> None:
46-
if SAVE_INTERMEDIATE:
47-
dump_file = Path(f"tmp/doctree/{slug_for_test()}.txt")
48-
dump_file.parent.mkdir(parents=True, exist_ok=True)
49-
with dump_file.open("w", encoding="utf-8") as f:
50-
dump_doctree(doctree, f)
47+
dump_file = Path(f"tmp/doctree/{slug_for_test()}.txt")
48+
dump_file.parent.mkdir(parents=True, exist_ok=True)
49+
with dump_file.open("w", encoding="utf-8") as f:
50+
dump_doctree(doctree, f)
5151

5252

5353
BLOCK_NODES = (nodes.paragraph,)

tests/test_extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def test_summarize_html(rst_file: str) -> None:
4343
(PROJECT / f"tmp/html/{root}_summary_nofix.html").write_text(
4444
nofix_summary, encoding="utf-8"
4545
)
46+
save_test_doctree(doctree)
4647

47-
save_test_doctree(doctree)
4848
assert 'class="self-link"' not in summary, f"Self-links found in {root}.html"
4949
summary_file = PROJECT / f"tests/data/{root}_summary.html"
5050
if summary_file.exists():

0 commit comments

Comments
 (0)