# HG changeset patch # User Jeff Hammel # Date 1359348138 28800 # Node ID 0f62570e80f3ac8737a5b458383cbfb9c31e82f2 # Parent 84890934af1fe04c2acfa6667b0e2729dbbaba3a add some failing tests diff -r 84890934af1f -r 0f62570e80f3 tests/sanity.txt --- a/tests/sanity.txt Sun Jan 27 19:03:42 2013 -0800 +++ b/tests/sanity.txt Sun Jan 27 20:42:18 2013 -0800 @@ -3,13 +3,14 @@ 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') + >>> attrs = dict(name='name', version='0.0', description='description', url='http://example.org') Make a distribution:: @@ -17,3 +18,17 @@ >>> 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()