diff options
author | Georg Brandl <georg@python.org> | 2010-10-23 17:31:52 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-10-23 17:31:52 (GMT) |
commit | 1e908af3354e20e18dfdcf30bc8aee6ab53ab1ee (patch) | |
tree | e8667db40effeb63db33a46b849aee2e4ac9e836 /Lib/test/test_ossaudiodev.py | |
parent | 1cae8b58eb5929b22a469e7ebb65382b808f7d04 (diff) | |
download | cpython-1e908af3354e20e18dfdcf30bc8aee6ab53ab1ee.zip cpython-1e908af3354e20e18dfdcf30bc8aee6ab53ab1ee.tar.gz cpython-1e908af3354e20e18dfdcf30bc8aee6ab53ab1ee.tar.bz2 |
#6518: enable context manager protocol for ossaudiodev types.
Diffstat (limited to 'Lib/test/test_ossaudiodev.py')
-rw-r--r-- | Lib/test/test_ossaudiodev.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py index 5dea640..9cb89d6 100644 --- a/Lib/test/test_ossaudiodev.py +++ b/Lib/test/test_ossaudiodev.py @@ -162,11 +162,13 @@ class OSSAudioDevTests(unittest.TestCase): def test_mixer_methods(self): # Issue #8139: ossaudiodev didn't initialize its types properly, # therefore some methods were unavailable. - mixer = ossaudiodev.openmixer() - try: + with ossaudiodev.openmixer() as mixer: self.assertGreaterEqual(mixer.fileno(), 0) - finally: - mixer.close() + + def test_with(self): + with ossaudiodev.open('w') as dsp: + pass + self.assertTrue(dsp.closed) def test_main(): |