4040 'eps with usetex'
4141])
4242def 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" :
4445 try :
4546 mpl ._get_executable_info ("gs" )
4647 except mpl .ExecutableNotFoundError as exc :
4748 pytest .skip (str (exc ))
48- elif rcParams . get ( "ps.userdistiller" ) == "xpdf" :
49+ elif mpl . rcParams [ "ps.usedistiller" ] == "xpdf" :
4950 try :
5051 mpl ._get_executable_info ("gs" ) # Effectively checks for ps2pdf.
5152 mpl ._get_executable_info ("pdftops" )
5253 except mpl .ExecutableNotFoundError as exc :
5354 pytest .skip (str (exc ))
5455
55- mpl .rcParams .update (rcParams )
56-
5756 fig , ax = plt .subplots ()
5857
5958 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):
6766 title += " \N{MINUS SIGN} \N{EURO SIGN} "
6867 ax .set_title (title )
6968 allowable_exceptions = []
70- if rcParams . get ( "text.usetex" ) :
69+ if mpl . rcParams [ "text.usetex" ] :
7170 allowable_exceptions .append (RuntimeError )
72- if rcParams . get ( "ps.useafm" ) :
71+ if mpl . rcParams [ "ps.useafm" ] :
7372 allowable_exceptions .append (mpl .MatplotlibDeprecationWarning )
7473 try :
7574 fig .savefig (s_buf , format = format , orientation = orientation ,
@@ -87,14 +86,14 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation, papersize):
8786 if format == 'ps' :
8887 # Default figsize = (8, 6) inches = (576, 432) points = (203.2, 152.4) mm.
8988 # Landscape orientation will swap dimensions.
90- if rcParams . get ( "ps.usedistiller" ) == "xpdf" :
89+ if mpl . rcParams [ "ps.usedistiller" ] == "xpdf" :
9190 # Some versions specifically show letter/203x152, but not all,
9291 # so we can only use this simpler test.
9392 if papersize == 'figure' :
9493 assert b'letter' not in s_val .lower ()
9594 else :
9695 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" ] :
9897 width = b'432.0' if orientation == 'landscape' else b'576.0'
9998 wanted = (b'-dDEVICEWIDTHPOINTS=' + width if papersize == 'figure'
10099 else b'-sPAPERSIZE' )
0 commit comments