@@ -130,6 +130,8 @@ def test_ft2font_invalid_args(tmp_path):
130
130
# filename argument.
131
131
with pytest .raises (TypeError , match = 'to a font file or a binary-mode file object' ):
132
132
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.
133
135
file = tmp_path / 'invalid-font.ttf'
134
136
file .write_text ('This is not a valid font file.' )
135
137
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):
145
147
file = fm .findfont ('DejaVu Sans' )
146
148
147
149
# hinting_factor argument.
148
- with pytest .raises (TypeError , match = 'cannot be interpreted as an integer ' ):
150
+ with pytest .raises (TypeError , match = 'incompatible constructor arguments ' ):
149
151
ft2font .FT2Font (file , 1.3 )
150
152
with pytest .raises (ValueError , match = 'hinting_factor must be greater than 0' ):
151
153
ft2font .FT2Font (file , 0 )
@@ -157,7 +159,7 @@ def test_ft2font_invalid_args(tmp_path):
157
159
ft2font .FT2Font (file , _fallback_list = [0 ]) # type: ignore[list-item]
158
160
159
161
# kerning_factor argument.
160
- with pytest .raises (TypeError , match = 'cannot be interpreted as an integer ' ):
162
+ with pytest .raises (TypeError , match = 'incompatible constructor arguments ' ):
161
163
ft2font .FT2Font (file , _kerning_factor = 1.3 )
162
164
163
165
0 commit comments