Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(75521)

Unified Diff: Lib/test/test_aifc.py

Issue 18919: Unify audio modules tests
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_aifc.py Mon Oct 14 10:43:26 2013 +0300
+++ b/Lib/test/test_aifc.py Mon Oct 14 11:56:47 2013 +0300
@@ -1,4 +1,4 @@
-from test.test_support import findfile, TESTFN, unlink, run_unittest
+from test.test_support import findfile, TESTFN, unlink, captured_stdout, run_unittest
import unittest
from test import audiotests
import os
@@ -225,7 +225,10 @@
b += 'COMM' + struct.pack('>LhlhhLL', 18, 0, 0, 0, 0, 0, 0)
b += 'SSND' + struct.pack('>L', 8) + '\x00' * 8
b += 'MARK' + struct.pack('>LhB', 3, 1, 1)
- f = aifc.open(io.BytesIO(b))
+ with captured_stdout() as s:
+ f = aifc.open(io.BytesIO(b))
+ self.assertEqual(s.getvalue(), 'Warning: MARK chunk contains only '
+ '0 markers instead of 1\n')
self.assertEqual(f.getmarkers(), None)
def test_read_comm_kludge_compname_even(self):
@@ -233,7 +236,9 @@
b += 'COMM' + struct.pack('>LhlhhLL', 18, 0, 0, 0, 0, 0, 0)
b += 'NONE' + struct.pack('B', 4) + 'even' + '\x00'
b += 'SSND' + struct.pack('>L', 8) + '\x00' * 8
- f = aifc.open(io.BytesIO(b))
+ with captured_stdout() as s:
+ f = aifc.open(io.BytesIO(b))
+ self.assertEqual(s.getvalue(), 'Warning: bad COMM chunk size\n')
self.assertEqual(f.getcompname(), 'even')
def test_read_comm_kludge_compname_odd(self):
@@ -241,7 +246,9 @@
b += 'COMM' + struct.pack('>LhlhhLL', 18, 0, 0, 0, 0, 0, 0)
b += 'NONE' + struct.pack('B', 3) + 'odd'
b += 'SSND' + struct.pack('>L', 8) + '\x00' * 8
- f = aifc.open(io.BytesIO(b))
+ with captured_stdout() as s:
+ f = aifc.open(io.BytesIO(b))
+ self.assertEqual(s.getvalue(), 'Warning: bad COMM chunk size\n')
self.assertEqual(f.getcompname(), 'odd')
def test_write_params_raises(self):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+