Skip to content

Commit e0fe354

Browse files
committed
Convert ft2font extension to pybind11
1 parent cb9cf3b commit e0fe354

File tree

3 files changed

+647
-1036
lines changed

3 files changed

+647
-1036
lines changed

lib/matplotlib/tests/test_ft2font.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ def test_ft2font_invalid_args(tmp_path):
130130
# filename argument.
131131
with pytest.raises(TypeError, match='to a font file or a binary-mode file object'):
132132
ft2font.FT2Font(None)
133+
with pytest.raises(TypeError, match='to a font file or a binary-mode file object'):
134+
ft2font.FT2Font(object()) # Not bytes or string, and has no read() method.
133135
file = tmp_path / 'invalid-font.ttf'
134136
file.write_text('This is not a valid font file.')
135137
with (pytest.raises(TypeError, match='to a font file or a binary-mode file object'),
@@ -145,7 +147,7 @@ def test_ft2font_invalid_args(tmp_path):
145147
file = fm.findfont('DejaVu Sans')
146148

147149
# hinting_factor argument.
148-
with pytest.raises(TypeError, match='cannot be interpreted as an integer'):
150+
with pytest.raises(TypeError, match='incompatible constructor arguments'):
149151
ft2font.FT2Font(file, 1.3)
150152
with pytest.raises(ValueError, match='hinting_factor must be greater than 0'):
151153
ft2font.FT2Font(file, 0)
@@ -157,7 +159,7 @@ def test_ft2font_invalid_args(tmp_path):
157159
ft2font.FT2Font(file, _fallback_list=[0]) # type: ignore[list-item]
158160

159161
# kerning_factor argument.
160-
with pytest.raises(TypeError, match='cannot be interpreted as an integer'):
162+
with pytest.raises(TypeError, match='incompatible constructor arguments'):
161163
ft2font.FT2Font(file, _kerning_factor=1.3)
162164

163165

0 commit comments

Comments
 (0)