(tmp_path)
| 206 | |
| 207 | |
| 208 | def test_plot_html_code_caption(tmp_path): |
| 209 | # Test that :code-caption: option adds caption to code block |
| 210 | shutil.copyfile(tinypages / 'conf.py', tmp_path / 'conf.py') |
| 211 | shutil.copytree(tinypages / '_static', tmp_path / '_static') |
| 212 | doctree_dir = tmp_path / 'doctrees' |
| 213 | (tmp_path / 'index.rst').write_text(""" |
| 214 | .. plot:: |
| 215 | :include-source: |
| 216 | :code-caption: Example plotting code |
| 217 | |
| 218 | import matplotlib.pyplot as plt |
| 219 | plt.plot([1, 2, 3], [1, 4, 9]) |
| 220 | """) |
| 221 | html_dir = tmp_path / '_build' / 'html' |
| 222 | build_sphinx_html(tmp_path, doctree_dir, html_dir) |
| 223 | |
| 224 | # Check that the HTML contains the code caption |
| 225 | html_content = (html_dir / 'index.html').read_text(encoding='utf-8') |
| 226 | assert 'Example plotting code' in html_content |
| 227 | # Verify the caption is associated with the code block |
| 228 | # (appears in a caption element) |
| 229 | assert '<p class="caption"' in html_content or 'caption' in html_content.lower() |
| 230 | |
| 231 | |
| 232 | def test_srcset_version(tmp_path): |
nothing calls this directly
no test coverage detected
searching dependent graphs…