Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_hover(ax, hover):
l1, = ax.plot([0, 1])
l2, = ax.plot([1, 2])
cursor = mplcursors.cursor(hover=hover)
_process_event("motion_notify_event", ax, (.5, .5), 1)
assert len(cursor.selections) == 0 # No trigger if mouse button pressed.
_process_event("motion_notify_event", ax, (.5, .5))
assert cursor.selections[0].artist == l1
_process_event("motion_notify_event", ax, (.5, 1))
assert bool(cursor.selections) == (hover == HoverMode.Persistent)
_process_event("motion_notify_event", ax, (.5, 1.5))
assert cursor.selections[0].artist == l2