Skip to content

Commit 78ac6b2

Browse files
committed
test updates: assert open raises, use curdir, rename
1 parent c33b908 commit 78ac6b2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Lib/test/test_wave.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import unittest
22
from test import audiotests
33
from test import support
4-
from test.support import os_helper
5-
import contextlib
64
import io
5+
import os
76
import struct
87
import sys
98
import wave
@@ -198,12 +197,11 @@ def test_read_wrong_sample_width(self):
198197
with self.assertRaisesRegex(wave.Error, 'bad sample width'):
199198
wave.open(io.BytesIO(b))
200199

201-
def test_write_to_protected_location(self):
200+
def test_open_in_write_raises(self):
202201
# gh-136523: Wave_write.__del__ should not throw
203202
with support.catch_unraisable_exception() as cm:
204-
with contextlib.suppress(OSError):
205-
with os_helper.temp_dir() as path:
206-
wave.open(path, "wb")
203+
with self.assertRaises(OSError):
204+
wave.open(os.curdir, "wb")
207205
support.gc_collect()
208206
self.assertIsNone(cm.unraisable)
209207

0 commit comments

Comments
 (0)