This is a complete re-integration of the work that was previously done by lrekucki and tmitchell; I've posted in the trac ticket as well.
I've updated all of the tests for trunk (no 2.5 support, python 3 support through 6, accounting for parts of their branches which have since been merged into trunk, or which are no longer needed). It's much cleaner than the original development line.
All tests pass on Python 2.6.7, 2.7.3, 3.2.3, all with and without hash randomization enabled.
Add assertInHTML method to TestCase
Add assertXML(Not)?Equal methods to TestCase
Add assertJSONEqual method to TestCase
Use new TestCase methods for equality comparisons
Use HTML parser to compare html snippets
Use XML parser to test Atom feeds
Don't rely on dictionary ordering in tests
Sort HTML attributes on generated forms
Ignore HTML class ordering in tests
Sort querystring components in generated URLs
This change to urlencode has to be rejected, because it is a major backwards incompatible change. Basically, it assumes that query strings are always, in essence, unordered collections. There is nothing in the HTTP spec that assumes that, and many apps will break under that assumption. For example, Trac's URLs for ticket reports are ordered collections.
Fixed. Thanks for your effort. See https://code.djangoproject.com/ticket/17758#comment:31