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

Appearance settings

Commit 3783494

Browse filesBrowse files
committed
Added smoke test for Axes.text
1 parent b617bf5 commit 3783494
Copy full SHA for 3783494

File tree

Expand file treeCollapse file tree

1 file changed

+25
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+25
-3
lines changed

‎lib/matplotlib/tests/test_datetime.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_datetime.py
+25-3Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,33 @@ def test_streamplot(self):
355355
fig, ax = plt.subplots()
356356
ax.streamplot(...)
357357

358-
@pytest.mark.xfail(reason="Test for text not written yet")
359358
@mpl.style.context("default")
360359
def test_text(self):
361-
fig, ax = plt.subplots()
362-
ax.text(...)
360+
mpl.rcParams["date.converter"] = 'concise'
361+
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, layout="constrained")
362+
363+
limit_value = 10
364+
font_properties = {'family': 'serif', 'size': 12, 'weight': 'bold'}
365+
test_date = datetime.datetime(2023, 10, 1)
366+
367+
x_data = np.array(range(1, limit_value))
368+
y_data = np.array(range(1, limit_value))
369+
370+
x_dates = np.array(
371+
[datetime.datetime(2023, 10, n) for n in range(1, limit_value)]
372+
)
373+
y_dates = np.array(
374+
[datetime.datetime(2023, 10, n) for n in range(1, limit_value)]
375+
)
376+
377+
ax1.plot(x_dates, y_data)
378+
ax1.text(test_date, 5, "Inserted Text", **font_properties)
379+
380+
ax2.plot(x_data, y_dates)
381+
ax2.text(7, test_date, "Inserted Text", **font_properties)
382+
383+
ax3.plot(x_dates, y_dates)
384+
ax3.text(test_date, test_date, "Inserted Text", **font_properties)
363385

364386
@pytest.mark.xfail(reason="Test for tricontour not written yet")
365387
@mpl.style.context("default")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.