Repository navigation
Enhancing support for tex and datetimes - #21568
Conversation
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
jklymak
left a comment
There was a problem hiding this comment.
Can you add a new test for the failing case as well? (Unless I missed it).
|
I can't seem to get the unit test that I want to work. I want to add the case to matplotlib/lib/matplotlib/tests/test_dates.py Lines 324 to 341 in f0632c0 by adding the following: @pytest.mark.parametrize('delta, expected', [
...
(datetime.timedelta(minutes=10),
[r'$\mathdefault{01\;00{:}%02d}$' % minu for minu in range(0, 11)]),
])
def test_date_formatter_usetex(delta, expected):
...But I get an assertion error that the output is in a different format: But when I run this script (just copied the function), it gives no assertion error. import datetime
import matplotlib.dates as mdates
delta = datetime.timedelta(minutes=10)
expected = [r'$\mathdefault{01\;00{:}%02d}$' % minu for minu in range(0, 11)]
d1 = datetime.datetime(1990, 1, 1)
d2 = d1 + delta
locator = mdates.AutoDateLocator(interval_multiples=False)
locator.create_dummy_axis()
locator.axis.set_view_interval(mdates.date2num(d1), mdates.date2num(d2))
formatter = mdates.AutoDateFormatter(locator, usetex=True)
assert [formatter(loc) for loc in locator()] == expectedAm I doing anything wrong? |
|
I can't look at details right now but tests are run under different defaults than current matplotlib. It's possible one of those has changed. |
|
In It would be great if you could update the test to modern matplotlib default formats, as we really should be testing those, and not the pre 2.0 ones ;-) |
…568-on-v3.5.x Backport PR #21568 on branch v3.5.x (Enhancing support for tex and datetimes)
Pin f0632c0fc7339f68e992ed63ae4cfac76cd41aad and its regression selectors for reproducible runs. Source: matplotlib/matplotlib#21568
PR Summary
Fixes #21518
Add braces to
:and replace space with\;when wrapping string to tex.PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).