summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_mailbox.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-06-18 02:25:14 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-06-18 02:25:14 (GMT)
commit953510560f5443f15f3a3d3099b102ad7764909a (patch)
treef4557140c14d10c1f9e61d7cb8c9ce93fce942b4 /Lib/test/test_mailbox.py
parent85198753f16a6f81ad43223a65adddaf50e14fad (diff)
parentc88bce1580c61ee33bf72e55b817940dba46d99c (diff)
downloadcpython-953510560f5443f15f3a3d3099b102ad7764909a.zip
cpython-953510560f5443f15f3a3d3099b102ad7764909a.tar.gz
cpython-953510560f5443f15f3a3d3099b102ad7764909a.tar.bz2
merge #11700: proxy object close methods can now be called multiple times
Diffstat (limited to 'Lib/test/test_mailbox.py')
-rw-r--r--Lib/test/test_mailbox.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index f5abb41..18aeec7 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -297,6 +297,13 @@ class TestMailbox(TestBase):
self.assertEqual(data1.decode('ascii').replace(os.linesep, '\n'),
_sample_message)
+ def test_get_file_can_be_closed_twice(self):
+ # Issue 11700
+ key = self._box.add(_sample_message)
+ f = self._box.get_file(key)
+ f.close()
+ f.close()
+
def test_iterkeys(self):
# Get keys using iterkeys()
self._check_iteration(self._box.keys, do_keys=True, do_values=False)
@@ -1862,8 +1869,12 @@ class TestProxyFileBase(TestBase):
def _test_close(self, proxy):
# Close a file
+ self.assertFalse(proxy.closed)
+ proxy.close()
+ self.assertTrue(proxy.closed)
+ # Issue 11700 subsequent closes should be a no-op.
proxy.close()
- self.assertRaises(AttributeError, lambda: proxy.close())
+ self.assertTrue(proxy.closed)
class TestProxyFile(TestProxyFileBase):