Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f900a84

Browse files
committed
TST: Fix monkey patch of find_tex_file
The normal function returns a `str`, so this patch returning bytes is confusing.
1 parent f6793ba commit f900a84

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/matplotlib/tests/test_dviread.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def test_PsfontsMap(monkeypatch):
10-
monkeypatch.setattr(dr, 'find_tex_file', lambda x: x)
10+
monkeypatch.setattr(dr, 'find_tex_file', lambda x: x.decode())
1111

1212
filename = str(Path(__file__).parent / 'baseline_images/dviread/test.map')
1313
fontmap = dr.PsfontsMap(filename)
@@ -18,15 +18,15 @@ def test_PsfontsMap(monkeypatch):
1818
assert entry.texname == key
1919
assert entry.psname == b'PSfont%d' % n
2020
if n not in [3, 5]:
21-
assert entry.encoding == b'font%d.enc' % n
21+
assert entry.encoding == 'font%d.enc' % n
2222
elif n == 3:
23-
assert entry.encoding == b'enc3.foo'
23+
assert entry.encoding == 'enc3.foo'
2424
# We don't care about the encoding of TeXfont5, which specifies
2525
# multiple encodings.
2626
if n not in [1, 5]:
27-
assert entry.filename == b'font%d.pfa' % n
27+
assert entry.filename == 'font%d.pfa' % n
2828
else:
29-
assert entry.filename == b'font%d.pfb' % n
29+
assert entry.filename == 'font%d.pfb' % n
3030
if n == 4:
3131
assert entry.effects == {'slant': -0.1, 'extend': 1.2}
3232
else:
@@ -37,13 +37,13 @@ def test_PsfontsMap(monkeypatch):
3737
assert entry.encoding is None
3838
entry = fontmap[b'TeXfont7']
3939
assert entry.filename is None
40-
assert entry.encoding == b'font7.enc'
40+
assert entry.encoding == 'font7.enc'
4141
entry = fontmap[b'TeXfont8']
42-
assert entry.filename == b'font8.pfb'
42+
assert entry.filename == 'font8.pfb'
4343
assert entry.encoding is None
4444
entry = fontmap[b'TeXfont9']
4545
assert entry.psname == b'TeXfont9'
46-
assert entry.filename == b'/absolute/font9.pfb'
46+
assert entry.filename == '/absolute/font9.pfb'
4747
# First of duplicates only.
4848
entry = fontmap[b'TeXfontA']
4949
assert entry.psname == b'PSfontA1'

0 commit comments

Comments
 (0)