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/test/test_os.py b/Lib/test/test_os.py
index 2b92255..2956d73 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -185,10 +185,28 @@
except TypeError:
pass
+from test_userdict import TestMappingProtocol
+
+class EnvironTests(TestMappingProtocol):
+ """check that os.environ object conform to mapping protocol"""
+ _tested_class = None
+ def _reference(self):
+ return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"}
+ def _empty_mapping(self):
+ os.environ.clear()
+ return os.environ
+ def setUp(self):
+ self.__save = dict(os.environ)
+ os.environ.clear()
+ def tearDown(self):
+ os.environ.clear()
+ os.environ.update(self.__save)
+
def test_main():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TemporaryFileTests))
suite.addTest(unittest.makeSuite(StatAttributeTests))
+ suite.addTest(unittest.makeSuite(EnvironTests))
run_suite(suite)
if __name__ == "__main__":