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.
This commit is contained in:
Raymond Hettinger 2003-03-09 07:05:43 +00:00
parent 42182ebaf6
commit 2c2d322884
6 changed files with 222 additions and 4 deletions

View file

@ -185,10 +185,28 @@ class StatAttributeTests(unittest.TestCase):
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__":