comparison tests/sanity.txt @ 76:b4fb27d126aa

tests work again \O/
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 27 Jan 2013 21:43:41 -0800
parents 0f62570e80f3
children
comparison
equal deleted inserted replaced
75:0f62570e80f3 76:b4fb27d126aa
1 Sanity Check 1 Sanity Check
2 ============ 2 ============
3 3
4 Imports:: 4 Imports::
5 5
6 >>> import email
7 >>> import pkginfo 6 >>> import pkginfo
8 >>> from distutils.dist import Distribution 7 >>> from distutils.dist import Distribution
9 >>> from StringIO import StringIO 8 >>> from StringIO import StringIO
10 9
11 Representative metadata:: 10 Representative metadata::
23 >>> newattrs['name'] == 'name' 22 >>> newattrs['name'] == 'name'
24 True 23 True
25 >>> newattrs['home_page'] == 'http://example.org' 24 >>> newattrs['home_page'] == 'http://example.org'
26 True 25 True
27 26
28 Convert to email:: 27 Convert to headers::
29 28
30 >>> message = email.message.Message() 29 >>> header_dict = dict((attr_name, header_name) for header_name, attr_name, multiple in pkginfo_dist._getHeaderAttrs())
31 >>> for key, value in newattrs.items(): 30 >>> info = dict((header_dict[key], value) for key, value in newattrs.items())
32 ... message[key] = value 31 >>> sorted(info.keys())
33 >>> message.keys() 32 ['Author', 'Author-email', 'Description', 'Home-Page', 'Keywords', 'License', 'Metadata-Version', 'Name', 'Platform', 'Summary', 'Supported-Platform', 'Version']
34 >>> message.items() 33 >>> info['Name'] == 'name'
34 True
35 >>> info['Home-Page'] == 'http://example.org' # it should actually be Home-page: http://svn.python.org/projects/peps/trunk/pep-0314.txt, bug in pkginfo
36 True