annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
74
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 Sanity Check
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 ============
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 Imports::
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
75
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
6 >>> import email
74
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 >>> import pkginfo
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 >>> from distutils.dist import Distribution
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 >>> from StringIO import StringIO
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 Representative metadata::
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
75
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
13 >>> attrs = dict(name='name', version='0.0', description='description', url='http://example.org')
74
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 Make a distribution::
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 >>> distribution = Distribution(attrs)
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 >>> buffer = StringIO()
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 >>> distribution.metadata.write_pkg_file(buffer)
84890934af1f start tests for third-party sanity check; first up setup() -> metadata conversion
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 >>> pkginfo_dist = pkginfo.Distribution()
75
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
21 >>> pkginfo_dist.parse(buffer.getvalue())
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
22 >>> newattrs = dict([(i, getattr(pkginfo_dist, i)) for i in pkginfo_dist])
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
23 >>> newattrs['name'] == 'name'
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
24 True
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
25 >>> newattrs['home_page'] == 'http://example.org'
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
26 True
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
27
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
28 Convert to email::
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
29
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
30 >>> message = email.message.Message()
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
31 >>> for key, value in newattrs.items():
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
32 ... message[key] = value
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
33 >>> message.keys()
0f62570e80f3 add some failing tests
Jeff Hammel <jhammel@mozilla.com>
parents: 74
diff changeset
34 >>> message.items()