SF patch #667730: More DictMixin

* Adds missing pop() methods to weakref.py
* Expands test suite to broaden coverage of objects with
  a mapping interface.

Contributed by Sebastien Keim.
diff --git a/Lib/weakref.py b/Lib/weakref.py
index 6153bd9..838ff5e 100644
--- a/Lib/weakref.py
+++ b/Lib/weakref.py
@@ -101,6 +101,18 @@
             if o is not None:
                 return key, o
 
+    def pop(self, key, *args):
+        try:
+            o = self.data.pop(key)()
+        except KeyError:
+            if args:
+                return args[0]
+            raise
+        if o is None:
+            raise KeyError, key
+        else:
+            return o
+
     def setdefault(self, key, default):
         try:
             wr = self.data[key]
@@ -225,6 +237,9 @@
             if o is not None:
                 return o, value
 
+    def pop(self, key, *args):
+        return self.data.pop(ref(key), *args)
+
     def setdefault(self, key, default):
         return self.data.setdefault(ref(key, self._remove),default)