File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
doc/api/next_api_changes/deprecations Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 1+ ``dviread.PsfontsMap `` now raises LookupError instead of KeyError for missing fonts
2+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original file line number Diff line number Diff line change 2727import struct
2828import subprocess
2929import sys
30- import textwrap
3130
3231import numpy as np
3332
@@ -852,14 +851,12 @@ def __getitem__(self, texname):
852851 try :
853852 return self ._parsed [texname ]
854853 except KeyError :
855- fmt = ('An associated PostScript font (required by Matplotlib) '
856- 'could not be found for TeX font {0!r} in {1!r}. This '
857- 'problem can often be solved by installing a suitable '
858- 'PostScript font package in your TeX package manager.' )
859- _log .info (textwrap .fill (
860- fmt .format (texname .decode ('ascii' ), self ._filename ),
861- break_on_hyphens = False , break_long_words = False ))
862- raise
854+ raise LookupError (
855+ f"An associated PostScript font (required by Matplotlib) "
856+ f"could not be found for TeX font { texname .decode ('ascii' )!r} "
857+ f"in { self ._filename !r} ; this problem can often be solved by "
858+ f"installing a suitable PostScript font package in your TeX "
859+ f"package manager" ) from None
863860
864861 def _parse_and_cache_line (self , line ):
865862 """
Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ def test_PsfontsMap(monkeypatch):
5454 entry = fontmap [b'TeXfontC' ]
5555 assert entry .psname == b'PSfontC3'
5656 # Missing font
57- with pytest .raises (KeyError , match = 'no-such-font' ):
57+ with pytest .raises (LookupError , match = 'no-such-font' ):
5858 fontmap [b'no-such-font' ]
59- with pytest .raises (KeyError , match = '%' ):
59+ with pytest .raises (LookupError , match = '%' ):
6060 fontmap [b'%' ]
6161
6262
You can’t perform that action at this time.
0 commit comments