diff options
author | Brian Curtin <brian@python.org> | 2017-11-10 16:38:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-10 16:38:25 (GMT) |
commit | 9f914a01affc55abe799afc521ce71612bb495a5 (patch) | |
tree | b002fd748ecccf5a416b655a85aef7fb30bd6633 /Lib/test/audiotests.py | |
parent | 5e0df74b3bc6391e9a7eba0fd84531ed99a78ae9 (diff) | |
download | cpython-9f914a01affc55abe799afc521ce71612bb495a5.zip cpython-9f914a01affc55abe799afc521ce71612bb495a5.tar.gz cpython-9f914a01affc55abe799afc521ce71612bb495a5.tar.bz2 |
bpo-31985: Deprecate openfp in aifc, sunau, and wave (#4344)
The openfp functions of aifp, sunau, and wave had pointed to the open
function of each module since 1993 as a matter of backwards
compatibility. In the case of aifc.openfp, it was both undocumented
and untested. This change begins the formal deprecation of those
openfp functions, with their removal coming in 3.9.
This additionally adds a TODO in test_pyclbr around using aifc.openfp,
though it shouldn't be changed until removal in 3.9.
Diffstat (limited to 'Lib/test/audiotests.py')
-rw-r--r-- | Lib/test/audiotests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/audiotests.py b/Lib/test/audiotests.py index d3e8e9e..0dad017 100644 --- a/Lib/test/audiotests.py +++ b/Lib/test/audiotests.py @@ -1,6 +1,7 @@ from test.support import findfile, TESTFN, unlink import array import io +from unittest import mock import pickle @@ -49,6 +50,17 @@ class AudioTests: 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): |