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

Skip to content

Commit 4fdf660

Browse files
committed
Add geometry tests.
1 parent 7c83ecc commit 4fdf660

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/matplotlib/tests/test_widgets.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import matplotlib.pyplot as plt
1212
from matplotlib.testing.decorators import cleanup
1313

14+
from numpy.testing import assert_allclose
1415

1516

1617
def get_ax():
@@ -94,6 +95,10 @@ def onselect(epress, erelease):
9495
event = get_event(ax, xdata=250, ydata=250, button=1)
9596
tool.release(event)
9697

98+
assert_allclose(tool.geometry,
99+
[[100., 100, 199, 199, 100], [100, 199, 199, 100, 100]],
100+
err_msg=tool.geometry)
101+
97102
assert ax._got_onselect
98103

99104

@@ -155,6 +160,8 @@ def onselect(epress, erelease):
155160
extents = [int(e) for e in tool.extents]
156161
assert extents == [70, 130, 70, 130], extents
157162

163+
assert tool.geometry.shape == (2, 74)
164+
assert_allclose(tool.geometry[:, 0], [70., 100])
158165

159166
def test_rectangle_handles():
160167
ax = get_ax()

0 commit comments

Comments
 (0)