40
40
'eps with usetex'
41
41
])
42
42
def test_savefig_to_stringio (format , use_log , rcParams , orientation , papersize ):
43
- if rcParams .get ("ps.usedistiller" ) == "ghostscript" :
43
+ mpl .rcParams .update (rcParams )
44
+ if mpl .rcParams ["ps.usedistiller" ] == "ghostscript" :
44
45
try :
45
46
mpl ._get_executable_info ("gs" )
46
47
except mpl .ExecutableNotFoundError as exc :
47
48
pytest .skip (str (exc ))
48
- elif rcParams . get ( "ps.userdistiller" ) == "xpdf" :
49
+ elif mpl . rcParams [ "ps.usedistiller" ] == "xpdf" :
49
50
try :
50
51
mpl ._get_executable_info ("gs" ) # Effectively checks for ps2pdf.
51
52
mpl ._get_executable_info ("pdftops" )
52
53
except mpl .ExecutableNotFoundError as exc :
53
54
pytest .skip (str (exc ))
54
55
55
- mpl .rcParams .update (rcParams )
56
-
57
56
fig , ax = plt .subplots ()
58
57
59
58
with io .StringIO () as s_buf , io .BytesIO () as b_buf :
@@ -67,9 +66,9 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
67
66
title += " \N{MINUS SIGN} \N{EURO SIGN} "
68
67
ax .set_title (title )
69
68
allowable_exceptions = []
70
- if rcParams . get ( "text.usetex" ) :
69
+ if mpl . rcParams [ "text.usetex" ] :
71
70
allowable_exceptions .append (RuntimeError )
72
- if rcParams . get ( "ps.useafm" ) :
71
+ if mpl . rcParams [ "ps.useafm" ] :
73
72
allowable_exceptions .append (mpl .MatplotlibDeprecationWarning )
74
73
try :
75
74
fig .savefig (s_buf , format = format , orientation = orientation ,
@@ -87,14 +86,14 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
87
86
if format == 'ps' :
88
87
# Default figsize = (8, 6) inches = (576, 432) points = (203.2, 152.4) mm.
89
88
# Landscape orientation will swap dimensions.
90
- if rcParams . get ( "ps.usedistiller" ) == "xpdf" :
89
+ if mpl . rcParams [ "ps.usedistiller" ] == "xpdf" :
91
90
# Some versions specifically show letter/203x152, but not all,
92
91
# so we can only use this simpler test.
93
92
if papersize == 'figure' :
94
93
assert b'letter' not in s_val .lower ()
95
94
else :
96
95
assert b'letter' in s_val .lower ()
97
- elif rcParams . get ( "ps.usedistiller" ) or rcParams . get ( "text.usetex" ) :
96
+ elif mpl . rcParams [ "ps.usedistiller" ] or mpl . rcParams [ "text.usetex" ] :
98
97
width = b'432.0' if orientation == 'landscape' else b'576.0'
99
98
wanted = (b'-dDEVICEWIDTHPOINTS=' + width if papersize == 'figure'
100
99
else b'-sPAPERSIZE' )
0 commit comments