summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_aifc.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-05-07 18:24:38 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-05-07 18:24:38 (GMT)
commit993527485ebb3f8a7e8759ab480547a0b61b82eb (patch)
tree1ab68554a371d560d34d2eae3a7cffe2f946f409 /Lib/test/test_aifc.py
parent865e01ab3ef817360e24c7ff70ed5c223c2ad6b4 (diff)
downloadcpython-993527485ebb3f8a7e8759ab480547a0b61b82eb.zip
cpython-993527485ebb3f8a7e8759ab480547a0b61b82eb.tar.gz
cpython-993527485ebb3f8a7e8759ab480547a0b61b82eb.tar.bz2
Merged revisions 72425-72426 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72425 | r.david.murray | 2009-05-07 12:27:02 -0400 (Thu, 07 May 2009) | 3 lines Issue5955: aifc's close method did not close the file it wrapped, now it does. This also means getfp method now returns the real fp. ........ r72426 | r.david.murray | 2009-05-07 12:29:19 -0400 (Thu, 07 May 2009) | 3 lines News item for Issue5955. ........
Diffstat (limited to 'Lib/test/test_aifc.py')
-rw-r--r--Lib/test/test_aifc.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index 1e84bd6..0248615 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -94,6 +94,21 @@ class AIFCTest(unittest.TestCase):
# XXX: this test fails, not sure if it should succeed or not
# self.assertEqual(f.readframes(5), fout.readframes(5))
+ def test_close(self):
+ class Wrapfile(object):
+ def __init__(self, file):
+ self.file = open(file, 'rb')
+ self.closed = False
+ def close(self):
+ self.file.close()
+ self.closed = True
+ def __getattr__(self, attr): return getattr(self.file, attr)
+ testfile = Wrapfile(self.sndfilepath)
+ f = self.f = aifc.open(testfile)
+ self.assertEqual(testfile.closed, False)
+ f.close()
+ self.assertEqual(testfile.closed, True)
+
def test_main():
run_unittest(AIFCTest)