MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_selector_clear_method

Function test_selector_clear_method

lib/matplotlib/tests/test_widgets.py:810–832  ·  view source on GitHub ↗
(ax, selector)

Source from the content-addressed store, hash-verified

808
809@pytest.mark.parametrize('selector', ['span', 'rectangle'])
810def test_selector_clear_method(ax, selector):
811 if selector == 'span':
812 tool = widgets.SpanSelector(ax, onselect=noop, direction='horizontal',
813 interactive=True,
814 ignore_event_outside=True)
815 else:
816 tool = widgets.RectangleSelector(ax, interactive=True)
817 click_and_drag(tool, start=(10, 10), end=(100, 120))
818 assert tool._selection_completed
819 assert tool.get_visible()
820 if selector == 'span':
821 assert tool.extents == (10, 100)
822
823 tool.clear()
824 assert not tool._selection_completed
825 assert not tool.get_visible()
826
827 # Do another cycle of events to make sure we can
828 click_and_drag(tool, start=(10, 10), end=(50, 120))
829 assert tool._selection_completed
830 assert tool.get_visible()
831 if selector == 'span':
832 assert tool.extents == (10, 50)
833
834
835def test_span_selector_add_state(ax):

Callers

nothing calls this directly

Calls 3

click_and_dragFunction · 0.90
get_visibleMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…