@@ -195,6 +195,13 @@ def test_finalize_options(self):
195
195
self .assertEqual (dist .metadata .platforms , ['one' , 'two' ])
196
196
self .assertEqual (dist .metadata .keywords , ['one' , 'two' ])
197
197
198
+ attrs = {'keywords' : 'foo bar' ,
199
+ 'platforms' : 'foo bar' }
200
+ dist = Distribution (attrs = attrs )
201
+ dist .finalize_options ()
202
+ self .assertEqual (dist .metadata .platforms , ['foo bar' ])
203
+ self .assertEqual (dist .metadata .keywords , ['foo bar' ])
204
+
198
205
def test_get_command_packages (self ):
199
206
dist = Distribution ()
200
207
self .assertEqual (dist .command_packages , None )
@@ -338,9 +345,46 @@ def test_classifier(self):
338
345
attrs = {'name' : 'Boa' , 'version' : '3.0' ,
339
346
'classifiers' : ['Programming Language :: Python :: 3' ]}
340
347
dist = Distribution (attrs )
348
+ self .assertEqual (dist .get_classifiers (),
349
+ ['Programming Language :: Python :: 3' ])
341
350
meta = self .format_metadata (dist )
342
351
self .assertIn ('Metadata-Version: 1.1' , meta )
343
352
353
+ def test_classifier_invalid_type (self ):
354
+ attrs = {'name' : 'Boa' , 'version' : '3.0' ,
355
+ 'classifiers' : ('Programming Language :: Python :: 3' ,)}
356
+ msg = "'classifiers' should be a 'list', not 'tuple'"
357
+ with self .assertRaises (TypeError , msg = msg ):
358
+ Distribution (attrs )
359
+
360
+ def test_keywords (self ):
361
+ attrs = {'name' : 'Monty' , 'version' : '1.0' ,
362
+ 'keywords' : ['spam' , 'eggs' , 'life of brian' ]}
363
+ dist = Distribution (attrs )
364
+ self .assertEqual (dist .get_keywords (),
365
+ ['spam' , 'eggs' , 'life of brian' ])
366
+
367
+ def test_keywords_invalid_type (self ):
368
+ attrs = {'name' : 'Monty' , 'version' : '1.0' ,
369
+ 'keywords' : ('spam' , 'eggs' , 'life of brian' )}
370
+ msg = "'keywords' should be a 'list', not 'tuple'"
371
+ with self .assertRaises (TypeError , msg = msg ):
372
+ Distribution (attrs )
373
+
374
+ def test_platforms (self ):
375
+ attrs = {'name' : 'Monty' , 'version' : '1.0' ,
376
+ 'platforms' : ['GNU/Linux' , 'Some Evil Platform' ]}
377
+ dist = Distribution (attrs )
378
+ self .assertEqual (dist .get_platforms (),
379
+ ['GNU/Linux' , 'Some Evil Platform' ])
380
+
381
+ def test_platforms_invalid_types (self ):
382
+ attrs = {'name' : 'Monty' , 'version' : '1.0' ,
383
+ 'platforms' : ('GNU/Linux' , 'Some Evil Platform' )}
384
+ msg = "'platforms' should be a 'list', not 'tuple'"
385
+ with self .assertRaises (TypeError , msg = msg ):
386
+ Distribution (attrs )
387
+
344
388
def test_download_url (self ):
345
389
attrs = {'name' : 'Boa' , 'version' : '3.0' ,
346
390
'download_url' : 'http://example.org/boa' }
0 commit comments