8000 TST: Parametrize test_savefig_to_stringio. · matplotlib/matplotlib@519afe3 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 519afe3

Browse files
committed
TST: Parametrize test_savefig_to_stringio.
1 parent dc9c93d commit 519afe3

File tree

1 file changed

+20
-36
lines changed
Expand file tree

1 file changed

+20
-36
lines changed

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,26 @@
2727
reason="This test needs a TeX installation")
2828

2929

30-
def _test_savefig_to_stringio(format='ps', use_log=False):
30+
@pytest.mark.parametrize('format, use_log, rcParams', [
31+
('ps', False, {}),
32+
needs_ghostscript(('ps', False, {'ps.usedistiller': 'ghostscript'})),
33+
needs_tex(needs_ghostscript(('ps', False, {'text.latex.unicode': True,
34+
'text.usetex': True}))),
35+
('eps', False, {}),
36+
('eps', True, {'ps.useafm': True}),
37+
needs_tex(needs_ghostscript(('eps', False, {'text.latex.unicode': True,
38+
'text.usetex': True}))),
39+
], ids=[
40+
'ps',
41+
'ps with distiller',
42+
'ps with usetex',
43+
'eps',
44+
'eps afm',
45+
'eps with usetex'
46+
])
47+
def test_savefig_to_stringio(format, use_log, rcParams):
48+
matplotlib.rcParams.update(rcParams)
49+
3150
fig, ax = plt.subplots()
3251
buffers = [
3352
six.moves.StringIO(),
@@ -60,41 +79,6 @@ def _test_savefig_to_stringio(format='ps', use_log=False):
6079
buffer.close()
6180

6281

63-
def test_savefig_to_stringio():
64-
_test_savefig_to_stringio()
65-
66-
67-
@needs_ghostscript
68-
def test_savefig_to_stringio_with_distiller():
69-
matplotlib.rcParams['ps.usedistiller'] = 'ghostscript'
70-
_test_savefig_to_stringio()
71-
72-
73-
@needs_tex
74-
@needs_ghostscript
75-
def test_savefig_to_stringio_with_usetex():
76-
matplotlib.rcParams['text.latex.unicode'] = True
77-
matplotlib.rcParams['text.usetex'] = True
78-
_test_savefig_to_stringio()
79-
80-
81-
def test_savefig_to_stringio_eps():
82-
_test_savefig_to_stringio(format='eps')
83-
84-
85-
def test_savefig_to_stringio_eps_afm():
86-
matplotlib.rcParams['ps.useafm'] = True
87-
_test_savefig_to_stringio(format='eps', use_log=True)
88-
89-
90-
@needs_tex
91-
@needs_ghostscript
92-
def test_savefig_to_stringio_with_usetex_eps():
93-
matplotlib.rcParams['text.latex.unicode'] = True
94-
matplotlib.rcParams['text.usetex'] = True
95-
_test_savefig_to_stringio(format='eps')
96-
97-
9882
def test_composite_image():
9983
# Test that figures can be saved with and without combining multiple images
10084
# (on a single set of axes) into a single composite image.

0 commit comments

Comments
 (0)
0