added test_axvspan in test.datetime.py#27130
added test_axvspan in test.datetime.py#27130scottshambaugh merged 3 commits intomatplotlib:mainfrom danielcobej:add_axvspan
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 week or so, please leave a new comment below and that should bring it to our attention. 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.
ksunden
left a comment
There was a problem hiding this comment.
Can you set the random seed so that we get a reproducible result?
(We aren't doing an image test here (yet) but we are likely to make it one at some point, and just having non reproducible test cases can make tracking things down all that much harder)
https://matplotlib.org/stable/devel/testing.html#random-data-in-tests
I've added seed number |
| ) | ||
| for i in range(np.random.randint(1, 5)): | ||
| xmin = start_date + np.random.randint(0, 30) * time_delta | ||
| xmax = xmin + np.random.randint(1, 3) * time_delta |
There was a problem hiding this comment.
Similar to my comment on #27139, please use hardcoded values here rather than random draws.
|
|
||
| bin_edges = [start_date + i * time_delta for i in range(31)] | ||
|
|
||
| fig, (ax1, ax2, ax3) = plt.subplots(3, 1, constrained_layout=True) |
There was a problem hiding this comment.
can shorten to fig, axes = plt.subplots(3, 1, constrained_layout=True), and remove axes = [ax1, ax2, ax3] below
scottshambaugh
left a comment
There was a problem hiding this comment.
This looks good to me, thank you for adding this test coverage!
I´ve added code for
test_axvspanmethod intest_datetime.pymentioned in issue #26864Image output: (edited)

PR summary
PR checklist