bpo-37320: Remove openfp() of aifc, sunau and wave (GH-14169)
aifc.openfp() alias to aifc.open(), sunau.openfp() alias to
sunau.open(), and wave.openfp() alias to wave.open() have been
removed. They were deprecated since Python 3.7.
diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py
index 0dad017..d3e8e9e 100644
--- a/Lib/test/audiotests.py
+++ b/Lib/test/audiotests.py
@@ -1,7 +1,6 @@
from test.support import findfile, TESTFN, unlink
import array
import io
-from unittest import mock
import pickle
@@ -50,17 +49,6 @@
self.assertEqual(pickle.loads(dump), params)
-class AudioMiscTests(AudioTests):
-
- def test_openfp_deprecated(self):
- arg = "arg"
- mode = "mode"
- with mock.patch(f"{self.module.__name__}.open") as mock_open, \
- self.assertWarns(DeprecationWarning):
- self.module.openfp(arg, mode=mode)
- mock_open.assert_called_with(arg, mode=mode)
-
-
class AudioWriteTests(AudioTests):
def create_file(self, testfile):
diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py
index c747584..5a95099 100644
--- a/Lib/test/test_aifc.py
+++ b/Lib/test/test_aifc.py
@@ -143,13 +143,12 @@
frames = byteswap(frames, 2)
-class AifcMiscTest(audiotests.AudioMiscTests, unittest.TestCase):
- module = aifc
-
+class AifcMiscTest(unittest.TestCase):
def test_skipunknown(self):
#Issue 2245
#This file contains chunk types aifc doesn't recognize.
- self.f = aifc.open(findfile('Sine-1000Hz-300ms.aif'))
+ f = aifc.open(findfile('Sine-1000Hz-300ms.aif'))
+ f.close()
def test_close_opened_files_on_error(self):
non_aifc_file = findfile('pluck-pcm8.wav', subdir='audiodata')
@@ -172,7 +171,8 @@
f.setparams((1, 1, 1, 1, b'NONE', b''))
f.close()
- f = self.f = aifc.open(TESTFN, 'rb')
+ f = aifc.open(TESTFN, 'rb')
+ self.addCleanup(f.close)
params = f.getparams()
self.assertEqual(params.nchannels, f.getnchannels())
self.assertEqual(params.sampwidth, f.getsampwidth())
@@ -208,7 +208,8 @@
fout.setmark(2, 0, b'even')
fout.writeframes(b'\x00')
fout.close()
- f = self.f = aifc.open(TESTFN, 'rb')
+ f = aifc.open(TESTFN, 'rb')
+ self.addCleanup(f.close)
self.assertEqual(f.getmarkers(), [(1, 0, b'odd'), (2, 0, b'even')])
self.assertEqual(f.getmark(1), (1, 0, b'odd'))
self.assertEqual(f.getmark(2), (2, 0, b'even'))
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 0b3934f..5313040 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -225,9 +225,7 @@
cm('random', ignore=('Random',)) # from _random import Random as CoreGenerator
cm('cgi', ignore=('log',)) # set with = in module
cm('pickle', ignore=('partial', 'PickleBuffer'))
- # TODO(briancurtin): openfp is deprecated as of 3.7.
- # Update this once it has been removed.
- cm('aifc', ignore=('openfp', '_aifc_params')) # set with = in module
+ cm('aifc', ignore=('_aifc_params',)) # set with = in module
cm('sre_parse', ignore=('dump', 'groups', 'pos')) # from sre_constants import *; property
cm('pdb')
cm('pydoc', ignore=('input', 'output',)) # properties
diff --git a/Lib/test/test_sunau.py b/Lib/test/test_sunau.py
index 470a100..7f1c0a5 100644
--- a/Lib/test/test_sunau.py
+++ b/Lib/test/test_sunau.py
@@ -119,10 +119,6 @@
frames = byteswap(frames, 2)
-class SunauMiscTests(audiotests.AudioMiscTests, unittest.TestCase):
- module = sunau
-
-
class SunauLowLevelTest(unittest.TestCase):
def test_read_bad_magic_number(self):
diff --git a/Lib/test/test_wave.py b/Lib/test/test_wave.py
index 8a42f8e4..eb231cb 100644
--- a/Lib/test/test_wave.py
+++ b/Lib/test/test_wave.py
@@ -105,9 +105,7 @@
frames = byteswap(frames, 4)
-class MiscTestCase(audiotests.AudioMiscTests, unittest.TestCase):
- module = wave
-
+class MiscTestCase(unittest.TestCase):
def test__all__(self):
blacklist = {'WAVE_FORMAT_PCM'}
support.check__all__(self, wave, blacklist=blacklist)