summaryrefslogtreecommitdiff
path: root/gr-blocks/python/blocks/qa_wavfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-blocks/python/blocks/qa_wavfile.py')
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_wavfile.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/gr-blocks/python/blocks/qa_wavfile.py b/gr-blocks/python/blocks/qa_wavfile.py
index 97978c936d..761b0be9c5 100755..100644
--- a/gr-blocks/python/blocks/qa_wavfile.py
+++ b/gr-blocks/python/blocks/qa_wavfile.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import os
@@ -38,35 +39,35 @@ class test_wavefile(gr_unittest.TestCase):
self.tb = None
def test_001_checkwavread(self):
- wf = blocks.wavfile_source(g_in_file)
- self.assertEqual(wf.sample_rate(), 8000)
+ wf = blocks.wavfile_source(g_in_file)
+ self.assertEqual(wf.sample_rate(), 8000)
def test_002_checkwavcopy(self):
- infile = g_in_file
- outfile = "test_out.wav"
+ infile = g_in_file
+ outfile = "test_out.wav"
- wf_in = blocks.wavfile_source(infile)
- wf_out = blocks.wavfile_sink(outfile,
+ wf_in = blocks.wavfile_source(infile)
+ wf_out = blocks.wavfile_sink(outfile,
wf_in.channels(),
wf_in.sample_rate(),
wf_in.bits_per_sample())
- self.tb.connect(wf_in, wf_out)
- self.tb.run()
- wf_out.close()
+ self.tb.connect(wf_in, wf_out)
+ self.tb.run()
+ wf_out.close()
- # we're losing all extra header chunks
- self.assertEqual(getsize(infile) - g_extra_header_len, getsize(outfile))
+ # we're losing all extra header chunks
+ self.assertEqual(getsize(infile) - g_extra_header_len, getsize(outfile))
- in_f = file(infile, 'rb')
- out_f = file(outfile, 'rb')
+ in_f = open(infile, 'rb')
+ out_f = open(outfile, 'rb')
- in_data = in_f.read()
- out_data = out_f.read()
+ in_data = in_f.read()
+ out_data = out_f.read()
out_f.close()
- os.remove(outfile)
- # cut extra header chunks input file
- self.assertEqual(in_data[:g_extra_header_offset] + \
- in_data[g_extra_header_offset + g_extra_header_len:], out_data)
+ os.remove(outfile)
+ # cut extra header chunks input file
+ self.assertEqual(in_data[:g_extra_header_offset] + \
+ in_data[g_extra_header_offset + g_extra_header_len:], out_data)
if __name__ == '__main__':
gr_unittest.run(test_wavefile, "test_wavefile.xml")