@@ -195,21 +195,24 @@ def check_trapped(x):
195
195
return x in ('True' , 'False' , 'Unknown' )
196
196
197
197
keywords = {
198
- 'Title' : is_string_like ,
199
- 'Author' : is_string_like ,
200
- 'Subject' : is_string_like ,
201
- 'Keywords' : is_string_like ,
202
- 'Creator' : is_string_like ,
203
- 'Producer' : is_string_like ,
204
- 'CreationDate' : is_date ,
205
- 'ModDate' : is_date ,
206
- 'Trapped' : check_trapped ,
198
+ 'Title' : ( is_string_like , 'an instance of str' ) ,
199
+ 'Author' : ( is_string_like , 'an instance of str' ) ,
200
+ 'Subject' : ( is_string_like , 'an instance of str' ) ,
201
+ 'Keywords' : ( is_string_like , 'an instance of str' ) ,
202
+ 'Creator' : ( is_string_like , 'an instance of str' ) ,
203
+ 'Producer' : ( is_string_like , 'an instance of str' ) ,
204
+ 'CreationDate' : ( is_date , 'an instance of datetime.datetime' ) ,
205
+ 'ModDate' : ( is_date , 'an instance of datetime.datetime' ) ,
206
+ 'Trapped' : ( check_trapped , 'one of {"True", "False", "Unknown"}' ) ,
207
207
}
208
208
for k in info :
209
209
if k not in keywords :
210
- cbook ._warn_external (f'Unknown infodict keyword: { k } ' )
211
- elif not keywords [k ](info [k ]):
212
- cbook ._warn_external (f'Bad value for infodict keyword { k } ' )
210
+ cbook ._warn_external (f'Unknown infodict keyword: { k !r} . '
211
+ f'Must be one of { set (keywords )!r} .' )
212
+ elif not keywords [k ][0 ](info [k ]):
213
+ cbook ._warn_external (f'Bad value for infodict keyword { k } . '
214
+ f'Got { info [k ]!r} which is not '
215
+ f'{ keywords [k ][1 ]} .' )
213
216
if 'Trapped' in info :
214
217
info ['Trapped' ] = Name (info ['Trapped' ])
215
218
0 commit comments