-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate old and little used formatters. #16170
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
import pytest | ||
|
||
import matplotlib | ||
from matplotlib import cbook | ||
import matplotlib.pyplot as plt | ||
import matplotlib.ticker as mticker | ||
|
||
|
@@ -457,7 +458,8 @@ class TestIndexFormatter: | |
(2, 'label2'), | ||
(2.5, '')]) | ||
def test_formatting(self, x, label): | ||
formatter = mticker.IndexFormatter(['label0', 'label1', 'label2']) | ||
with cbook._suppress_matplotlib_deprecation_warning(): | ||
formatter = mticker.IndexFormatter(['label0', 'label1', 'label2']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are deprecating, is there any reason to keep the test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the usual policy is to get rid of the test only when the API is deprecated too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that makes sense because we can't break things until we can break them... |
||
assert formatter(x) == label | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the deprecation for OldScalarFormatter. While you are at it, maybe also deprecate OldAutoLocator. I think the renaming of these things to "Old" was probably done with eventual deprecation and removal in mind. The IndexFormatters also seem like good candidates for the trash bin. I can imagine NullFormatter being useful in a user interface as one of a choice of Formatters, but it's true, it can be trivially recreated directly or via FuncFormatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, added it for OldScalarFormatter. Also deprecated OldAutoLocator.
NullFormatter is trivial to recreate with FuncFormatter (or even simpler,
FormatStrFormatter("")
:-)), but I think it's widely used enough and its implementation so simple that we can leave it in, at least for now.