[TIP] dicts in doctests
Barry Warsaw
barry at python.org
Wed Sep 17 18:02:36 PDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sep 17, 2008, at 07:43 PM, Pete wrote:
>Is there a preferred way of testing dicts in doctests? The random key
>ordering can be problematic (IIRC, this bit the django port to Jython).
>
> >>> dict([('x', 1), ('y', 2)])
>{'x': 1, 'y': 2}
>>> sorted(dict.items())
- -Barry
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFI0aiw2YZpQepbvXERAmriAKCshEF6J8tmuOeHeHn/9tOTbFcPhQCaAova
2W6+XL/5e4O9vzJ4mq2fKHE=
=hdlz
-----END PGP SIGNATURE-----
More information about the testing-in-python
mailing list