mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
#6518: enable context manager protocol for ossaudiodev types.
This commit is contained in:
parent
1cae8b58eb
commit
1e908af335
4 changed files with 42 additions and 4 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue