Trim leading whitespace before doctest flags (#13164)

This commit is contained in:
Maciej Olko 2025-01-04 01:30:03 +01:00 committed by GitHub
parent 432bc5e50b
commit ad0c343d36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,7 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
blankline_re = re.compile(r'^\s*<BLANKLINE>', re.MULTILINE) blankline_re = re.compile(r'^\s*<BLANKLINE>', re.MULTILINE)
doctestopt_re = re.compile(r'#\s*doctest:.+$', re.MULTILINE) doctestopt_re = re.compile(r'[ \t]*#\s*doctest:.+$', re.MULTILINE)
def is_allowed_version(spec: str, version: str) -> bool: def is_allowed_version(spec: str, version: str) -> bool:

View File

@ -15,6 +15,8 @@ def test_trim_doctest_flags_html(app):
assert 'QUUX' not in result assert 'QUUX' not in result
assert 'CORGE' not in result assert 'CORGE' not in result
assert 'GRAULT' in result assert 'GRAULT' in result
assert '<span class="n">now</span><span class="p">()</span> \n' not in result
assert '<span class="n">now</span><span class="p">()</span>\n' in result
@pytest.mark.sphinx( @pytest.mark.sphinx(