Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aifc.openfp had pointed to aifc.open since 1993 and it was both undocumented and untested since being assigned as a matter of backwards compatibility. This change begins its formal deprecation.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I just left some minor comments.
| aifc.openfp(arg, mode=mode) | ||
|
|
||
| self.assertTrue(len(w) == 1) | ||
| self.assertTrue(issubclass(w[0].category, DeprecationWarning)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Style nit: assertIsInstance might be better option here.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I initially thought that as well, but category isn't an instance there.
The other comments look good and I'll push a fix for them.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
By using assertWarns we get the behavior we needed from those two assertTrue lines, so I just removed them in ebe685d.
| warnings.simplefilter("always") | ||
| aifc.openfp(arg, mode=mode) | ||
|
|
||
| self.assertTrue(len(w) == 1) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Style nit: I'd use assertEqual instead.
| arg = "arg" | ||
| mode = "mode" | ||
| with warnings.catch_warnings(record=True) as w: | ||
| warnings.simplefilter("always") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We could replace those two lines with assertWarns.
By using assertWarns we no longer need to check the number of warnings or the category of the warning, as assertWarns already handles that for us.
This additionally moves the test to Lib/audiotests.py and has MiscTests in each module's tests inherit from the new AudioMiscTests which does the deprecation test.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you Brian!
Please replace wave.openfp with wave.open in sndhdr.py. Add versiondeprecated in the documentation for wave.openfp and sunau.openfp.
| @@ -915,7 +915,10 @@ def open(f, mode=None): | |||
| else: | |||
| raise Error("mode must be 'r', 'rb', 'w', or 'wb'") | |||
|
|
|||
| openfp = open # B/W compatibility | |||
| def openfp(f, mode=None): | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment that test_pyclbr.py should be updated after removing openfp.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Comment added. After this merges I'm going to create an issue in Roundup and assign it to myself so it gets formally tracked.
This additionally adds a TODO in test_pyclbr around using openfp, though it shouldn't be changed until after 3.7.
| @@ -63,6 +63,8 @@ The :mod:`sunau` module defines the following functions: | |||
|
|
|||
| A synonym for :func:`.open`, maintained for backwards compatibility. | |||
|
|
|||
| .. versiondeprecated:: 3.7 | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, the correct name of this directive is deprecated! Or deprecated-removed if you have assigned the date of removing.
These are being deprecated now for 3.7 and will be removed in 3.9.
aifc.openfp had pointed to aifc.open since 1993* and it was both undocumented and untested since being assigned as a matter of backwards compatibility. This change begins its formal deprecation.
* 7bc817d
https://bugs.python.org/issue31985