10000 Add timedelta rectangle test · matplotlib/matplotlib@4a203d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a203d8

Browse files
committed
Add timedelta rectangle test
1 parent 0e1e91b commit 4a203d8

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

0 commit comments

Comments
 (0)
0