("Forward-port" of r46506)

Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.

Remaining open issues:
 * test_extcall is an output test, messy to make robust
 * tarfile.py has a potential bug here, but I'm not familiar
   enough with this code.  Filed in as SF bug #1496501.
 * urllib2.HTTPPasswordMgr() returns a random result if there is more
   than one matching root path.  I'm asking python-dev for
   clarification...
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py
index 8511a5a..feb6ddf 100644
--- a/Lib/test/test_csv.py
+++ b/Lib/test/test_csv.py
@@ -875,7 +875,10 @@
     def test_delimiters(self):
         sniffer = csv.Sniffer()
         dialect = sniffer.sniff(self.sample3)
-        self.assertEqual(dialect.delimiter, "0")
+        # given that all three lines in sample3 are equal,
+        # I think that any character could have been 'guessed' as the
+        # delimiter, depending on dictionary order
+        self.assert_(dialect.delimiter in self.sample3)
         dialect = sniffer.sniff(self.sample3, delimiters="?,")
         self.assertEqual(dialect.delimiter, "?")
         dialect = sniffer.sniff(self.sample3, delimiters="/,")