Convert test_userdict to use the collections.UserDict.
Fix-up collections.UserDict.__contains__ to work correctly when __missing__ is defined.
Fix-up Mapping.__eq__ to only match instances of Mapping.
diff --git a/Lib/collections.py b/Lib/collections.py
index b883832..d06445b 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -135,6 +135,9 @@
def __iter__(self):
return iter(self.data)
+ # Modify __contains__ to work correctly when __missing__ is present
+ def __contains__(self, key):
+ return key in self.data
# Now, add the methods in dicts but not in MutableMapping
def __repr__(self): return repr(self.data)