-
Notifications
You must be signed in to change notification settings - Fork 947
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
Add DeprecationWarning when using Mapping for options #2130
Add DeprecationWarning when using Mapping for options #2130
Conversation
For Selection Widgets, add a `DeprecationWarning` whenever a `Mapping` (dictionaries) is used as options.
* Use `warnings.simplefilter('always')` for DeprecationWarning * More specific test on warning message
Thank you! Can you remove the (to be clear, please keep the source text changes in the notebook, and the one place where we have printed output that would change). |
Sure thing! And it also makes the diff cleaner. |
Adding to 7.3 - let's see if we can get this in... |
Looks like there is a test failure. We'll try to get this in first thing for 7.4. |
The failure is related to the new Not sure what it is yet as the tests pass locally with Python 2.7.14 |
As an attempt to fix Python 2 behavior.
Tests are now green after the last commit. There seems to be a different behavior between Python 2.7 and Python 3 when it comes to testing warnings (even though the documentation looks identical between the two versions: https://docs.python.org/3.7/library/warnings.html#testing-warnings). Python 2 requires to manually clear the warning registry if we want to be able to catch them: import inspect
module = inspect.getmodule(Dropdown)
getattr(module, '__warningregistry__', {}).clear() This has also been mentioned in other project testing for warning being triggered, for example with Matplotlib: matplotlib/matplotlib@0017d3e |
@jtpio these seems to be a conflict. Could you please rebase your PR on master? |
@SylvainCorlay - We should try to get this in for 7.4 as well. |
Should be good now 👍 |
That's an awesome problem, that we're tripping over ourselves to add more testing :). |
Fixes #1958.
For Selection Widgets, add a
DeprecationWarning
whenever aMapping
(dictionaries) is used as options.I'll do a second pass on the documentation to remove all mentions to dictionaries as possible values for
options
.TODO