1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
From: Dmitry Shachnev <mitya57@debian.org>
Date: Sat, 27 Sep 2025 12:45:47 +0300
Subject: Make the tests pass with Docutils 0.22
Forwarded: no
---
tests/test_sphinx.py | 7 +++++++
tests/test_sphinx/test_sources_dropdown_basic_.xml | 16 ++++++++--------
tests/test_sphinx/test_sources_tabbed_basic_.xml | 22 +++++++++++-----------
3 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py
index 35affa1..e43d775 100644
--- a/tests/test_sphinx.py
+++ b/tests/test_sphinx.py
@@ -1,8 +1,10 @@
from pathlib import Path
import shutil
+import docutils
import pytest
import sphinx
+from docutils.nodes import Element
from sphinx.testing.path import path
from sphinx_panels.tabs import TabbedHtmlTransform
@@ -34,6 +36,11 @@ def test_sources(sphinx_app_factory, file_regression, folder):
doctree["source"] = "source"
if sphinx.version_info < (7, 1):
doctree["translation_progress"] = "{'total': 0, 'translated': 0}"
+ if docutils.__version_info__ < (0, 22):
+ for node in doctree.findall(Element):
+ for name, value in node.attlist():
+ if isinstance(value, bool):
+ node.attributes[name] = str(int(value))
file_regression.check(
doctree.pformat(),
encoding="utf8",
diff --git a/tests/test_sphinx/test_sources_dropdown_basic_.xml b/tests/test_sphinx/test_sources_dropdown_basic_.xml
index 4c42825..6791350 100644
--- a/tests/test_sphinx/test_sources_dropdown_basic_.xml
+++ b/tests/test_sphinx/test_sources_dropdown_basic_.xml
@@ -2,27 +2,27 @@
<section ids="title" names="title">
<title>
Title
- <dropdown_main classes="sphinx-bs dropdown card mb-3 shadow" opened="False">
+ <dropdown_main classes="sphinx-bs dropdown card mb-3 shadow" opened="0">
<dropdown_title classes="summary-title card-header bg-primary text-white text-center font-weight-bold">
My Content
- <container classes="summary-down" is_div="True">
+ <container classes="summary-down" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg>
- <container classes="summary-up" is_div="True">
+ <container classes="summary-up" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg>
- <container classes="summary-content card-body bg-light text-right font-italic" is_div="True">
+ <container classes="summary-content card-body bg-light text-right font-italic" is_div="1">
<paragraph classes="card-text">
Is formatted
- <dropdown_main classes="sphinx-bs dropdown card mb-3 fade-in-slide-down" opened="False">
+ <dropdown_main classes="sphinx-bs dropdown card mb-3 fade-in-slide-down" opened="0">
<dropdown_title classes="summary-title card-header">
Fade In
- <container classes="summary-down" is_div="True">
+ <container classes="summary-down" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-down" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M5.22 8.72a.75.75 0 000 1.06l6.25 6.25a.75.75 0 001.06 0l6.25-6.25a.75.75 0 00-1.06-1.06L12 14.44 6.28 8.72a.75.75 0 00-1.06 0z"></path></svg>
- <container classes="summary-up" is_div="True">
+ <container classes="summary-up" is_div="1">
<raw format="html" xml:space="preserve">
<svg version="1.1" width="24" height="24" class="octicon octicon-chevron-up" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M18.78 15.28a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 00-1.06 0l-6.25 6.25a.75.75 0 101.06 1.06L12 9.56l5.72 5.72a.75.75 0 001.06 0z"></path></svg>
- <container classes="summary-content card-body" is_div="True">
+ <container classes="summary-content card-body" is_div="1">
<paragraph classes="card-text">
Content
diff --git a/tests/test_sphinx/test_sources_tabbed_basic_.xml b/tests/test_sphinx/test_sources_tabbed_basic_.xml
index f55e06e..57f4a90 100644
--- a/tests/test_sphinx/test_sources_tabbed_basic_.xml
+++ b/tests/test_sphinx/test_sources_tabbed_basic_.xml
@@ -2,31 +2,31 @@
<section ids="title" names="title">
<title>
Title
- <container classes="tabbed-set" is_div="True">
- <tabbed_input checked="True" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <container classes="tabbed-set" is_div="1">
+ <tabbed_input checked="1" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 1
- <container classes="tabbed-content" is_div="True">
+ <container classes="tabbed-content" is_div="1">
<paragraph>
Tab 1 content
- <tabbed_input checked="False" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <tabbed_input checked="0" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 2
- <container classes="tabbed-content pl-1 bg-primary" is_div="True">
+ <container classes="tabbed-content pl-1 bg-primary" is_div="1">
<paragraph>
Tab 2 content
- <container classes="tabbed-set" is_div="True">
- <tabbed_input checked="False" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <container classes="tabbed-set" is_div="1">
+ <tabbed_input checked="0" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 3
- <container classes="tabbed-content" is_div="True">
+ <container classes="tabbed-content" is_div="1">
<paragraph>
Tab 3 content
- <literal_block force="False" highlight_args="{}" language="python" linenos="False" xml:space="preserve">
+ <literal_block force="0" highlight_args="{}" language="python" linenos="0" xml:space="preserve">
import pip
- <tabbed_input checked="True" id="mock-uuid" set_id="mock-uuid" type="radio">
+ <tabbed_input checked="1" id="mock-uuid" set_id="mock-uuid" type="radio">
<tabbed_label classes="tabbed-label" input_id="mock-uuid">
Tab 4
- <container classes="tabbed-content" is_div="True">
+ <container classes="tabbed-content" is_div="1">
<paragraph>
Tab 4 content
|