summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_aifc.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-05-07 16:27:02 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-05-07 16:27:02 (GMT)
commit8fd522fb5f45aa05252c32063dc9c624f2e788b3 (patch)
treed59e2fe8b9ca033acae8fd5a7835a1681407e0d0 /Lib/test/test_aifc.py
parent02588111254fb02f703d762e5990544852bd9965 (diff)
downloadcpython-8fd522fb5f45aa05252c32063dc9c624f2e788b3.zip
cpython-8fd522fb5f45aa05252c32063dc9c624f2e788b3.tar.gz
cpython-8fd522fb5f45aa05252c32063dc9c624f2e788b3.tar.bz2
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.
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 0aed908..54694ea 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -91,6 +91,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)
+ 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)