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

Skip to content

Commit c68e6eb

Browse files
committed
Add a test for find_tex_file(..., format=...)
1 parent e983457 commit c68e6eb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/matplotlib/tests/test_dviread.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import json
1414
import pytest
1515
import sqlite3
16+
import warnings
1617

1718

1819
def test_PsfontsMap(monkeypatch):
@@ -163,3 +164,18 @@ def test_find_tex_files(tmpdir):
163164
{'foo.pfb': '{s}tmp{s}foo.pfb'.format(s=os.path.sep),
164165
'cmr10.tfm': '{s}usr{s}local{s}cmr10.tfm'.format(s=os.path.sep)}
165166
assert mock_popen.called
167+
168+
169+
def test_find_tex_file_format():
170+
with mock.patch('matplotlib.dviread.subprocess.Popen') as mock_popen:
171+
mock_proc = mock.Mock()
172+
stdout = b'/foo/bar/baz\n'
173+
mock_proc.configure_mock(**{'communicate.return_value': (stdout, b'')})
174+
mock_popen.return_value = mock_proc
175+
176+
warnings.filterwarnings(
177+
'ignore',
178+
'The format option to find_tex_file is deprecated.*',
179+
UserWarning)
180+
assert dr.find_tex_file('foobar', format='tfm') == '/foo/bar/baz'
181+
assert mock_popen.called

0 commit comments

Comments
 (0)