summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-04-29 13:51:44 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-04-29 13:51:44 (GMT)
commit971b1b100b02cf7d79ec2ca5599f916f31925b48 (patch)
tree2b46a21db8d96db3fabbf03a58c86c8a6d495f91 /Lib
parent25b4add5b0569e626afd8b3b5b7dd4a7551372c9 (diff)
downloadcpython-971b1b100b02cf7d79ec2ca5599f916f31925b48.zip
cpython-971b1b100b02cf7d79ec2ca5599f916f31925b48.tar.gz
cpython-971b1b100b02cf7d79ec2ca5599f916f31925b48.tar.bz2
Now that we've got a test_aifc, add a few tests.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_aifc.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index 58380e0..7e5b2e9 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -15,6 +15,36 @@ class AIFCTest(unittest.TestCase):
f = aifc.open(self.sndfilepath)
f.close()
+ def test_params(self):
+ f = aifc.open(self.sndfilepath)
+ self.assertEqual(f.getnchannels(), 2)
+ self.assertEqual(f.getsampwidth(), 2)
+ self.assertEqual(f.getframerate(), 48000)
+ self.assertEqual(f.getnframes(), 14400)
+ self.assertEqual(f.getcomptype(), 'NONE')
+ self.assertEqual(f.getcompname(), 'not compressed')
+ self.assertEqual(f.getparams(), (2, 2, 48000, 14400, 'NONE', 'not compressed'))
+ f.close()
+
+ def test_read(self):
+ f = aifc.open(self.sndfilepath)
+ self.assertEqual(f.tell(), 0)
+ self.assertEqual(f.readframes(2), '\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
+ f.rewind()
+ pos0 = f.tell()
+ self.assertEqual(pos0, 0)
+ self.assertEqual(f.readframes(2), '\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
+ pos2 = f.tell()
+ self.assertEqual(pos2, 2)
+ self.assertEqual(f.readframes(2), '\x17t\x17t"\xad"\xad')
+ f.setpos(pos2)
+ self.assertEqual(f.readframes(2), '\x17t\x17t"\xad"\xad')
+ f.setpos(pos0)
+ self.assertEqual(f.readframes(2), '\x00\x00\x00\x00\x0b\xd4\x0b\xd4')
+ f.close()
+
+ #XXX Need more tests!
+
def test_main():
run_unittest(AIFCTest)