Skip to content

Commit

Permalink
test: fix Sphinx 7 incompat
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Mar 5, 2024
1 parent 171671f commit 3e983af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ def file_regression(file_regression):


class FileRegression:
ignores = (
ignores = ( )
changes = (
# TODO: Remove when support for Sphinx<=6 is dropped,
re.escape(" translation_progress=\"{'total': 0, 'translated': 0}\""),
(re.escape(" translation_progress=\"{'total': 0, 'translated': 0}\""), ""),
# TODO: Remove when support for Sphinx<7.2 is dropped,
r"original_uri=\"[^\"]*\"\s",
(r"original_uri=\"[^\"]*\"\s", ""),
# TODO: Remove when support for Sphinx<7.2 is dropped
("Link to", "Permalink to")
)

def __init__(self, file_regression):
Expand All @@ -100,6 +103,6 @@ def check(self, data, **kwargs):
return self.file_regression.check(self._strip_ignores(data), **kwargs)

def _strip_ignores(self, data):
for ig in self.ignores:
data = re.sub(ig, "", data)
for src, dst in self.changes:
data = re.sub(src, dst, data)
return data
2 changes: 1 addition & 1 deletion tests/test_solution/_linked_enum.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
\[P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t)\]</div>
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div class="math notranslate nohighlight" id="equation-ex-math">
<span class="eqno">(1)<a class="headerlink" href="#equation-ex-math" title="Link to this equation"></a></span>\[P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t)\]</div>
<span class="eqno">(1)<a class="headerlink" href="#equation-ex-math" title="Permalink to this equation"></a></span>\[P_t(x, y) = \mathbb 1\{x = y\} + t Q(x, y) + o(t)\]</div>
</section>
</div>

0 comments on commit 3e983af

Please sign in to comment.