File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,22 @@ def test_savefig_metadata(monkeypatch):
161
161
}
162
162
163
163
164
+ def test_invalid_metadata (monkeypatch ):
165
+ fig , ax = plt .subplots ()
166
+
167
+ with pytest .warns (UserWarning ,
168
+ match = 'not an instance of datetime.datetime.' ):
169
+ fig .savefig (io .BytesIO (), format = 'pdf' ,
170
+ metadata = {'ModDate' : '1968-08-01' })
171
+
172
+ with pytest .warns (UserWarning ,
173
+ match = 'not one of {"True", "False", "Unknown"}' ):
174
+ fig .savefig (io .BytesIO (), format = 'pdf' , metadata = {'Trapped' : 'foo' })
175
+
176
+ with pytest .warns (UserWarning , match = 'not an instance of str.' ):
177
+ fig .savefig (io .BytesIO (), format = 'pdf' , metadata = {'Title' : 1234 })
178
+
179
+
164
180
def test_multipage_metadata (monkeypatch ):
165
181
pikepdf = pytest .importorskip ('pikepdf' )
166
182
monkeypatch .setenv ('SOURCE_DATE_EPOCH' , '0' )
You can’t perform that action at this time.
0 commit comments