diff options
author | Charles-François Natali <neologix@free.fr> | 2011-06-11 16:58:24 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-06-11 16:58:24 (GMT) |
commit | a52930834823502254839af17cc5d972d7f82856 (patch) | |
tree | a1ae7d7131afb807f1b11cbc8e02bab15df56c91 /Lib/test/test_ossaudiodev.py | |
parent | d8649b1a1aa05834d6b53769ea82089e0f6221c3 (diff) | |
download | cpython-a52930834823502254839af17cc5d972d7f82856.zip cpython-a52930834823502254839af17cc5d972d7f82856.tar.gz cpython-a52930834823502254839af17cc5d972d7f82856.tar.bz2 |
Issue #12287: In ossaudiodev, check that the device isn't closed in several
methods.
Diffstat (limited to 'Lib/test/test_ossaudiodev.py')
-rw-r--r-- | Lib/test/test_ossaudiodev.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py index 9cb89d6..3908a05 100644 --- a/Lib/test/test_ossaudiodev.py +++ b/Lib/test/test_ossaudiodev.py @@ -170,6 +170,22 @@ class OSSAudioDevTests(unittest.TestCase): pass self.assertTrue(dsp.closed) + def test_on_closed(self): + dsp = ossaudiodev.open('w') + dsp.close() + self.assertRaises(ValueError, dsp.fileno) + self.assertRaises(ValueError, dsp.read, 1) + self.assertRaises(ValueError, dsp.write, b'x') + self.assertRaises(ValueError, dsp.writeall, b'x') + self.assertRaises(ValueError, dsp.bufsize) + self.assertRaises(ValueError, dsp.obufcount) + self.assertRaises(ValueError, dsp.obufcount) + self.assertRaises(ValueError, dsp.obuffree) + self.assertRaises(ValueError, dsp.getptr) + + mixer = ossaudiodev.openmixer() + mixer.close() + self.assertRaises(ValueError, mixer.fileno) def test_main(): try: |