@@ -195,6 +195,13 @@ def test_finalize_options(self):
195195 self .assertEqual (dist .metadata .platforms , ['one' , 'two' ])
196196 self .assertEqual (dist .metadata .keywords , ['one' , 'two' ])
197197
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+
198205 def test_get_command_packages (self ):
199206 dist = Distribution ()
200207 self .assertEqual (dist .command_packages , None )
@@ -338,9 +345,46 @@ def test_classifier(self):
338345 attrs = {'name' : 'Boa' , 'version' : '3.0' ,
339346 'classifiers' : ['Programming Language :: Python :: 3' ]}
340347 dist = Distribution (attrs )
348+ self .assertEqual (dist .get_classifiers (),
349+ ['Programming Language :: Python :: 3' ])
341350 meta = self .format_metadata (dist )
342351 self .assertIn ('Metadata-Version: 1.1' , meta )
343352
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+
344388 def test_download_url (self ):
345389 attrs = {'name' : 'Boa' , 'version' : '3.0' ,
346390 'download_url' : 'http://example.org/boa' }
0 commit comments