Skip to content

Commit 0434774

Browse files
committed
Add test_bar in test_datetime
1 parent 4aa7efe commit 0434774

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lib/matplotlib/tests/test_datetime.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,24 @@ def test_axvspan(self):
6262
fig, ax = plt.subplots()
6363
ax.axvspan(...)
6464

65-
@pytest.mark.xfail(reason="Test for bar not written yet")
6665
@mpl.style.context("default")
6766
def test_bar(self):
68-
fig, ax = plt.subplots()
69-
ax.bar(...)
67+
mpl.rcParams["date.converter"] = "concise"
68+
range_threshold = 10
69+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained")
70+
71+
x_dates = np.array(
72+
[datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)]
73+
)
74+
y_dates = np.array(
75+
[datetime.datetime(2023, 10, delta) for delta in range(1, range_threshold)]
76+
)
77+
x_ranges = np.array(range(1, range_threshold))
78+
y_ranges = np.array(range(1, range_threshold))
79+
80+
ax1.bar(x_dates, y_ranges)
81+
ax2.bar(x_dates, y_dates)
82+
ax3.bar(x_ranges, y_dates)
7083

7184
@pytest.mark.xfail(reason="Test for bar_label not written yet")
7285
@mpl.style.context("default")

0 commit comments

Comments
 (0)