Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f78133e commit b187215Copy full SHA for b187215
lib/matplotlib/tests/test_backend_pdf.py
@@ -161,6 +161,26 @@ def test_savefig_metadata(monkeypatch):
161
}
162
163
164
+def test_invalid_metadata():
165
+ fig, ax = plt.subplots()
166
+
167
+ with pytest.warns(UserWarning,
168
+ match="Unknown infodict keyword: 'foobar'."):
169
+ fig.savefig(io.BytesIO(), format='pdf', metadata={'foobar': 'invalid'})
170
171
172
+ match='not an instance of datetime.datetime.'):
173
+ fig.savefig(io.BytesIO(), format='pdf',
174
+ metadata={'ModDate': '1968-08-01'})
175
176
177
+ match='not one of {"True", "False", "Unknown"}'):
178
+ fig.savefig(io.BytesIO(), format='pdf', metadata={'Trapped': 'foo'})
179
180
+ with pytest.warns(UserWarning, match='not an instance of str.'):
181
+ fig.savefig(io.BytesIO(), format='pdf', metadata={'Title': 1234})
182
183
184
def test_multipage_metadata(monkeypatch):
185
pikepdf = pytest.importorskip('pikepdf')
186
monkeypatch.setenv('SOURCE_DATE_EPOCH', '0')
0 commit comments