8000 test: replaced test with a more representative test case · matplotlib/matplotlib@c4b684c · GitHub
[go: up one dir, main page]

Skip to content

Commit c4b684c

Browse files
committed
test: replaced test with a more representative test case
1 parent 852824b commit c4b684c

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -402,35 +402,10 @@ def test_document_font_size():
402402
plt.legend()
403403

404404

405-
@needs_pgf_pdflatex
406405
@pytest.mark.backend("pgf")
407406
def test_pgf_documentclass_written():
408-
import pathlib
409-
from tempfile import TemporaryDirectory
410-
# Set custom documentclass
411-
mpl.rcParams["pgf.texsystem"] = "pdflatex"
412-
mpl.rcParams["pgf.documentclass"] = "IEEEtran"
407+
from matplotlib.backends.backend_pgf import LatexManager
413408

414-
with TemporaryDirectory() as tmpdir:
415-
tmpdir = pathlib.Path(tmpdir)
416-
texfile = tmpdir / "figure.tex"
417-
pgffile = tmpdir / "figure.pgf"
418-
419-
# Generate PGF figure
420-
fig, ax = plt.subplots()
421-
ax.plot([1, 2, 3], [4, 5, 6])
422-
fig.savefig(pgffile, format="pgf")
423-
424-
# Manually generate .tex using PGF backend logic
425-
texfile.write_text(
426-
"\n".join([
427-
r"\documentclass{IEEEtran}",
428-
r"\usepackage{pgf}",
429-
r"\begin{document}",
430-
r"\input{figure.pgf}",
431-
r"\end{document}"
432-
])
433-
)
434-
435-
content = texfile.read_text()
436-
assert r"\documentclass{IEEEtran}" in content
409+
mpl.rcParams["pgf.documentclass"] = "IEEEtran"
410+
header = LatexManager._build_latex_header()
411+
assert r"\documentclass{IEEEtran}" in header

0 commit comments

Comments
 (0)
0