#7310: fix the repr() of os.environ

This commit is contained in:
Ezio Melotti 2010-02-22 15:59:01 +00:00
parent 5961b0e35f
commit 19e4acfa15
3 changed files with 20 additions and 0 deletions

View file

@ -400,6 +400,14 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
for key, value in self._reference().items():
self.assertEqual(os.environ.get(key), value)
# Issue 7310
def test___repr__(self):
"""Check that the repr() of os.environ looks like environ({...})."""
env = os.environ
self.assertTrue(isinstance(env.data, dict))
self.assertEqual(repr(env), 'environ({!r})'.format(env.data))
class WalkTests(unittest.TestCase):
"""Tests for os.walk()."""