@cleanup
@needs_tex
def test_missing_psfont(monkeypatch):
 from matplotlib import rc
 def psfont(*args, **kwargs):
  return dviread.PsFont(texname=u'texfont', psname=u'Some Font', effects=None, encoding=None, filename=None)
 monkeypatch.setattr(dviread.PsfontsMap, u'__getitem__', psfont)
 rc(u'text', usetex=True)
 (fig, ax) = plt.subplots()
 ax.text(0.5, 0.5, u'hello')
 with tempfile.TemporaryFile() as tmpfile:
  with pytest.raises(ValueError):
   fig.savefig(tmpfile, format=u'svg')

@ cleanup @ needs_tex def test_missing_psfont ( monkeypatch ) : from matplotlib import rc def psfont ( * args , ** kwargs ) : return dviread . PsFont ( texname = u'texfont' , psname = u'Some Font' , effects = None , encoding = None , filename = None ) monkeypatch . setattr ( dviread . PsfontsMap , u'__getitem__' , psfont ) rc ( u'text' , usetex = True ) ( fig , ax ) = plt . subplots ( ) ax . text ( 0.5 , 0.5 , u'hello' ) with tempfile . TemporaryFile ( ) as tmpfile : with pytest . raises ( ValueError ) : fig . savefig ( tmpfile , format = u'svg' )
an error is raised if a tex font lacks a type-1 equivalent .