Mercurial > hg > PaInt
comparison 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 |
comparison
equal
deleted
inserted
replaced
74:84890934af1f | 75:0f62570e80f3 |
---|---|
1 Sanity Check | 1 Sanity Check |
2 ============ | 2 ============ |
3 | 3 |
4 Imports:: | 4 Imports:: |
5 | 5 |
6 >>> import email | |
6 >>> import pkginfo | 7 >>> import pkginfo |
7 >>> from distutils.dist import Distribution | 8 >>> from distutils.dist import Distribution |
8 >>> from StringIO import StringIO | 9 >>> from StringIO import StringIO |
9 | 10 |
10 Representative metadata:: | 11 Representative metadata:: |
11 | 12 |
12 >>> attrs = dict(name='name', version='0.0', description='description') | 13 >>> attrs = dict(name='name', version='0.0', description='description', url='http://example.org') |
13 | 14 |
14 Make a distribution:: | 15 Make a distribution:: |
15 | 16 |
16 >>> distribution = Distribution(attrs) | 17 >>> distribution = Distribution(attrs) |
17 >>> buffer = StringIO() | 18 >>> buffer = StringIO() |
18 >>> distribution.metadata.write_pkg_file(buffer) | 19 >>> distribution.metadata.write_pkg_file(buffer) |
19 >>> pkginfo_dist = pkginfo.Distribution() | 20 >>> pkginfo_dist = pkginfo.Distribution() |
21 >>> pkginfo_dist.parse(buffer.getvalue()) | |
22 >>> newattrs = dict([(i, getattr(pkginfo_dist, i)) for i in pkginfo_dist]) | |
23 >>> newattrs['name'] == 'name' | |
24 True | |
25 >>> newattrs['home_page'] == 'http://example.org' | |
26 True | |
27 | |
28 Convert to email:: | |
29 | |
30 >>> message = email.message.Message() | |
31 >>> for key, value in newattrs.items(): | |
32 ... message[key] = value | |
33 >>> message.keys() | |
34 >>> message.items() |