summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-03-09 07:05:43 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-03-09 07:05:43 (GMT)
commit2c2d322884ee72077a256ec3cd0aa9ce3580eedc (patch)
treed64fac31dcecd48ed44aceb9d5fb6d8dc415e95f /Lib/test/test_os.py
parent42182ebaf6387371c238d2a3484e7f1e085c9d1c (diff)
downloadcpython-2c2d322884ee72077a256ec3cd0aa9ce3580eedc.zip
cpython-2c2d322884ee72077a256ec3cd0aa9ce3580eedc.tar.gz
cpython-2c2d322884ee72077a256ec3cd0aa9ce3580eedc.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py18
1 files changed, 18 insertions, 0 deletions
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 @@ 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__":