Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71b9568

Browse files
committed
Add timedelta rectangle test
1 parent 5a4d09d commit 71b9568

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
@@ -365,3 +365,15 @@ def test_units_rectangle():
365365
ax.add_patch(p)
366366
ax.set_xlim([4*U.km, 7*U.km])
367367
ax.set_ylim([5*U.km, 9*U.km])
368+
369+
370+
def test_datetime_rectangle():
371+
# Check that creating a rectangle with timedeltas doesn't fail
372+
from datetime import datetime, timedelta
373+
374+
start = datetime(2017, 1, 1, 0, 0, 0)
375+
delta = timedelta(seconds=16)
376+
patch = mpatches.Rectangle((start, 0), delta, 1)
377+
378+
fig, ax = plt.subplots()
379+
ax.add_patch(patch)

0 commit comments

Comments
 (0)