Skip to content

Commit 8208ddc

Browse files
committed
Add timedelta rectangle test
1 parent e8ce736 commit 8208ddc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_patches.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,15 @@ def test_connection_patch():
362362
axesA=ax2, axesB=ax1,
363363
arrowstyle="->")
364364
ax2.add_artist(con)
365+
366+
367+
def test_datetime_rectangle():
368+
# Check that creating a rectangle with timedeltas doesn't fail
369+
from datetime import datetime, timedelta
370+
371+
start = datetime(2017, 1, 1, 0, 0, 0)
372+
delta = timedelta(seconds=16)
373+
patch = mpatches.Rectangle((start, 0), delta, 1)
374+
375+
fig, ax = plt.subplots()
376+
ax.add_patch(patch)

0 commit comments

Comments
 (0)