summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ossaudiodev.py
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2011-06-11 16:58:24 (GMT)
committerCharles-François Natali <neologix@free.fr>2011-06-11 16:58:24 (GMT)
commita52930834823502254839af17cc5d972d7f82856 (patch)
treea1ae7d7131afb807f1b11cbc8e02bab15df56c91 /Lib/test/test_ossaudiodev.py
parentd8649b1a1aa05834d6b53769ea82089e0f6221c3 (diff)
downloadcpython-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.py16
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: