-
Notifications
You must be signed in to change notification settings - Fork 773
Next
Next commit
add custom decorator to send method deprecation warning
- Loading branch information
commit f
8000
68d8222b0d82480735a51095e1dcd75a2c1cebc
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import unittest | ||
import warnings | ||
|
||
from twilio.base.obsolete import deprecated_method | ||
|
||
|
||
class DeprecatedMethodTest(unittest.TestCase): | ||
|
||
def test_deprecation_decorator(self): | ||
|
||
@deprecated_method('new_method') | ||
def old_method(): | ||
pass | ||
|
||
with warnings.catch_warnings(record=True) as caught_warnings: | ||
warnings.simplefilter("always") | ||
|
||
# Call function that should raise a warning | ||
old_method() | ||
|
||
if len(caught_warnings): | ||
self.assertEqual( | ||
str(caught_warnings[0].message), | ||
'Function method .old_method() is being deprecated in favor of .new_method()' | ||
) | ||
assert issubclass(caught_warnings[0].category, DeprecationWarning) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rename child twiml methods to be the tag name and deprecate old methods #495
New issue
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
Uh oh!
There was an error while loading. Please reload this page.
Rename child twiml methods to be the tag name and deprecate old methods #495
Changes from 1 commit
f68d822
f4e9963
6e3b9f0
547b22e
b0bb73e
b4a43e9
8a51840
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.