diff options
author | Sandro Tosi <sandro.tosi@gmail.com> | 2012-01-01 21:53:08 (GMT) |
---|---|---|
committer | Sandro Tosi <sandro.tosi@gmail.com> | 2012-01-01 21:53:08 (GMT) |
commit | 70efbefcc5c26e675c064f50dd2c64cc375f20ac (patch) | |
tree | eb51bc9cfa64c72ceb573271537c8a053310dd1a /Lib/test | |
parent | bdd5354700d2ebafc98375ef2982fbcbb42b1ba5 (diff) | |
download | cpython-70efbefcc5c26e675c064f50dd2c64cc375f20ac.zip cpython-70efbefcc5c26e675c064f50dd2c64cc375f20ac.tar.gz cpython-70efbefcc5c26e675c064f50dd2c64cc375f20ac.tar.bz2 |
Issue #13594: various fixes to aifc module; patch by Oleg Plakhotnyuk
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_aifc.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py index af2305f..085b949 100644 --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -120,6 +120,29 @@ class AIFCTest(unittest.TestCase): self.assertEqual(fout.getsampwidth(), 2) fout.initfp(None) + def test_write_markers_values(self): + fout = self.fout = aifc.open(io.BytesIO(), 'wb') + self.assertEqual(fout.getmarkers(), None) + fout.setmark(1, 0, b'foo1') + fout.setmark(1, 1, b'foo2') + self.assertEqual(fout.getmark(1), (1, 1, b'foo2')) + self.assertEqual(fout.getmarkers(), [(1, 1, b'foo2')]) + fout.initfp(None) + + def test_read_markers(self): + fout = self.fout = aifc.open(TESTFN, 'wb') + fout.aiff() + fout.setparams((1, 1, 1, 1, b'NONE', b'')) + fout.setmark(1, 0, b'odd') + fout.setmark(2, 0, b'even') + fout.writeframes(b'\x00') + fout.close() + f = self.f = aifc.open(TESTFN, 'rb') + self.assertEqual(f.getmarkers(), [(1, 0, b'odd'), (2, 0, b'even')]) + self.assertEqual(f.getmark(1), (1, 0, b'odd')) + self.assertEqual(f.getmark(2), (2, 0, b'even')) + self.assertRaises(aifc.Error, f.getmark, 3) + def test_main(): run_unittest(AIFCTest) |