Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_sunau.SunAUTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_lin
def test_ulaw

Public Attributes

 f

Detailed Description

Definition at line 12 of file test_sunau.py.


Member Function Documentation

Definition at line 14 of file test_sunau.py.

00014 
00015     def setUp(self):
00016         self.f = None

Here is the caller graph for this function:

Definition at line 17 of file test_sunau.py.

00017 
00018     def tearDown(self):
00019         if self.f is not None:
00020             self.f.close()
00021         try:
00022             os.remove(TESTFN)
00023         except OSError:
00024             pass

Here is the caller graph for this function:

Definition at line 25 of file test_sunau.py.

00025 
00026     def test_lin(self):
00027         self.f = sunau.open(TESTFN, 'w')
00028         self.f.setnchannels(nchannels)
00029         self.f.setsampwidth(sampwidth)
00030         self.f.setframerate(framerate)
00031         self.f.setcomptype('NONE', 'not compressed')
00032         output = b'\xff\x00\x12\xcc' * (nframes * nchannels * sampwidth // 4)
00033         self.f.writeframes(output)
00034         self.f.close()
00035 
00036         self.f = sunau.open(TESTFN, 'rb')
00037         self.assertEqual(nchannels, self.f.getnchannels())
00038         self.assertEqual(sampwidth, self.f.getsampwidth())
00039         self.assertEqual(framerate, self.f.getframerate())
00040         self.assertEqual(nframes, self.f.getnframes())
00041         self.assertEqual('NONE', self.f.getcomptype())
00042         self.assertEqual(self.f.readframes(nframes), output)
00043         self.f.close()

Here is the call graph for this function:

Definition at line 44 of file test_sunau.py.

00044 
00045     def test_ulaw(self):
00046         self.f = sunau.open(TESTFN, 'w')
00047         self.f.setnchannels(nchannels)
00048         self.f.setsampwidth(sampwidth)
00049         self.f.setframerate(framerate)
00050         self.f.setcomptype('ULAW', '')
00051         # u-law compression is lossy, therefore we can't expect non-zero data
00052         # to come back unchanged.
00053         output = b'\0' * nframes * nchannels * sampwidth
00054         self.f.writeframes(output)
00055         self.f.close()
00056 
00057         self.f = sunau.open(TESTFN, 'rb')
00058         self.assertEqual(nchannels, self.f.getnchannels())
00059         self.assertEqual(sampwidth, self.f.getsampwidth())
00060         self.assertEqual(framerate, self.f.getframerate())
00061         self.assertEqual(nframes, self.f.getnframes())
00062         self.assertEqual('ULAW', self.f.getcomptype())
00063         self.assertEqual(self.f.readframes(nframes), output)
00064         self.f.close()
00065 

Here is the call graph for this function:


Member Data Documentation

Definition at line 15 of file test_sunau.py.


The documentation for this class was generated from the following file: