File tree 3 files changed +10
-11
lines changed
doc/api/next_api_changes/deprecations
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 27
27
import struct
28
28
import subprocess
29
29
import sys
30
- import textwrap
31
30
32
31
import numpy as np
33
32
@@ -852,14 +851,12 @@ def __getitem__(self, texname):
852
851
try :
853
852
return self ._parsed [texname ]
854
853
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
863
860
864
861
def _parse_and_cache_line (self , line ):
865
862
"""
Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ def test_PsfontsMap(monkeypatch):
54
54
entry = fontmap [b'TeXfontC' ]
55
55
assert entry .psname == b'PSfontC3'
56
56
# Missing font
57
- with pytest .raises (KeyError , match = 'no-such-font' ):
57
+ with pytest .raises (LookupError , match = 'no-such-font' ):
58
58
fontmap [b'no-such-font' ]
59
- with pytest .raises (KeyError , match = '%' ):
59
+ with pytest .raises (LookupError , match = '%' ):
60
60
fontmap [b'%' ]
61
61
62
62
You can’t perform that action at this time.
0 commit comments