Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7ea11b7

Browse files
authored
Merge pull request#27037 from kots14/axes-plot_date-unit-test-for-issue-26864
add test_plot_date in test_datetime.py
2 parentscaa750e +128541a commit7ea11b7

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
@@ -252,11 +252,24 @@ def test_plot(self):
252252
ax2.plot(range(1,N),x)
253253
ax3.plot(x,x)
254254

255-
@pytest.mark.xfail(reason="Test for plot_date not written yet")
256255
@mpl.style.context("default")
257256
deftest_plot_date(self):
258-
fig,ax=plt.subplots()
259-
ax.plot_date(...)
257+
mpl.rcParams["date.converter"]="concise"
258+
range_threshold=10
259+
fig, (ax1,ax2,ax3)=plt.subplots(3,1,layout="constrained")
260+
261+
x_dates=np.array(
262+
[datetime.datetime(2023,10,delta)fordeltainrange(1,range_threshold)]
263+
)
264+
y_dates=np.array(
265+
[datetime.datetime(2023,10,delta)fordeltainrange(1,range_threshold)]
266+
)
267+
x_ranges=np.array(range(1,range_threshold))
268+
y_ranges=np.array(range(1,range_threshold))
269+
270+
ax1.plot_date(x_dates,y_dates)
271+
ax2.plot_date(x_dates,y_ranges)
272+
ax3.plot_date(x_ranges,y_dates)
260273

261274
@pytest.mark.xfail(reason="Test for psd not written yet")
262275
@mpl.style.context("default")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp