Skip to content

Commit c27fbad

Browse files
committed
Add type annotations and fix formatting
1 parent f8d1efe commit c27fbad

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
project = 'test-numfig-include'
2-
exclude_patterns = ['_build'] # NOT excluding _includes to test include-aware duplicate handling
2+
exclude_patterns = [
3+
'_build'
4+
] # NOT excluding _includes to test include-aware duplicate handling
35
numfig = True

tests/test_domains/test_domain_std_include.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
from __future__ import annotations
44

5+
from typing import TYPE_CHECKING
6+
57
import pytest
68

9+
if TYPE_CHECKING:
10+
from pathlib import Path
11+
12+
from sphinx.testing.util import SphinxTestApp
13+
714

815
@pytest.mark.sphinx('html', testroot='numfig-include')
9-
def test_numref_in_included_file_no_warning(app):
16+
def test_numref_in_included_file_no_warning(app: SphinxTestApp) -> None:
1017
"""Test that numref works with included files without duplicate label warnings.
1118
1219
When a file is included via the include directive and also processed as a
@@ -25,7 +32,7 @@ def test_numref_in_included_file_no_warning(app):
2532

2633

2734
@pytest.mark.sphinx('html', testroot='numfig-include', freshenv=True)
28-
def test_numref_in_included_file_correct_numbering(app):
35+
def test_numref_in_included_file_correct_numbering(app: SphinxTestApp) -> None:
2936
"""Test that figure numbering is correct when files are included."""
3037
app.build()
3138

@@ -44,7 +51,7 @@ def test_numref_in_included_file_correct_numbering(app):
4451

4552

4653
@pytest.mark.sphinx('html', testroot='numfig-include-duplicate', freshenv=True)
47-
def test_real_duplicate_label_still_warns(app):
54+
def test_real_duplicate_label_still_warns(app: SphinxTestApp) -> None:
4855
"""Test that real duplicate labels (different source files) still produce warnings.
4956
5057
When two separate documents (doc1.rst and doc2.rst) both define the same label,
@@ -54,13 +61,13 @@ def test_real_duplicate_label_still_warns(app):
5461
app.build()
5562
warnings = app.warning.getvalue()
5663

57-
# Should have Sphinx's duplicate label warning because this is a REAL duplicate
58-
# (label 'shared-label' defined in both doc1.rst AND doc2.rst - different source files)
64+
# Should have duplicate label warning because this is a REAL duplicate
65+
# (label 'shared-label' defined in both doc1.rst AND doc2.rst)
5966
assert 'duplicate label shared-label' in warnings
6067

6168

6269
@pytest.mark.sphinx('html', testroot='numfig-include', freshenv=True)
63-
def test_incremental_build_no_stale_labels(app, tmp_path):
70+
def test_incremental_build_no_stale_labels(app: SphinxTestApp, tmp_path: Path) -> None:
6471
"""Test that incremental builds work correctly with included files.
6572
6673
When a document is rebuilt incrementally, the duplicate detection should

0 commit comments

Comments
 (0)