Mercurial > hg > PaInt
view tests/sanity.txt @ 75:0f62570e80f3
add some failing tests
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sun, 27 Jan 2013 20:42:18 -0800 |
parents | 84890934af1f |
children | b4fb27d126aa |
line wrap: on
line source
Sanity Check ============ Imports:: >>> import email >>> import pkginfo >>> from distutils.dist import Distribution >>> from StringIO import StringIO Representative metadata:: >>> attrs = dict(name='name', version='0.0', description='description', url='http://example.org') Make a distribution:: >>> distribution = Distribution(attrs) >>> buffer = StringIO() >>> distribution.metadata.write_pkg_file(buffer) >>> pkginfo_dist = pkginfo.Distribution() >>> pkginfo_dist.parse(buffer.getvalue()) >>> newattrs = dict([(i, getattr(pkginfo_dist, i)) for i in pkginfo_dist]) >>> newattrs['name'] == 'name' True >>> newattrs['home_page'] == 'http://example.org' True Convert to email:: >>> message = email.message.Message() >>> for key, value in newattrs.items(): ... message[key] = value >>> message.keys() >>> message.items()