diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-16 12:01:31 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-16 12:01:31 (GMT) |
commit | 452bab4acf57c8dd156b794fe0d1672e1ab29b43 (patch) | |
tree | d167584d1dd05c4ca5303c4ff91c2dfa927a5e06 /Lib/test/audiotests.py | |
parent | 7714ebbe0e7556bbfa6b768e434042b55474939c (diff) | |
download | cpython-452bab4acf57c8dd156b794fe0d1672e1ab29b43.zip cpython-452bab4acf57c8dd156b794fe0d1672e1ab29b43.tar.gz cpython-452bab4acf57c8dd156b794fe0d1672e1ab29b43.tar.bz2 |
Issue #16685: Added support for writing any bytes-like objects in the aifc,
sunau, and wave modules.
Diffstat (limited to 'Lib/test/audiotests.py')
-rw-r--r-- | Lib/test/audiotests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py index c22f0a1..0e9175d 100644 --- a/Lib/test/audiotests.py +++ b/Lib/test/audiotests.py @@ -146,6 +146,30 @@ class AudioWriteTests(AudioTests): self.check_file(TESTFN, self.nframes, self.frames) + def test_write_bytearray(self): + f = self.create_file(TESTFN) + f.setnframes(self.nframes) + f.writeframes(bytearray(self.frames)) + f.close() + + self.check_file(TESTFN, self.nframes, self.frames) + + def test_write_array(self): + f = self.create_file(TESTFN) + f.setnframes(self.nframes) + f.writeframes(array.array('h', self.frames)) + f.close() + + self.check_file(TESTFN, self.nframes, self.frames) + + def test_write_memoryview(self): + f = self.create_file(TESTFN) + f.setnframes(self.nframes) + f.writeframes(memoryview(self.frames)) + f.close() + + self.check_file(TESTFN, self.nframes, self.frames) + def test_incompleted_write(self): with open(TESTFN, 'wb') as testfile: testfile.write(b'ababagalamaga') |