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

Function test_annotation_contains

lib/matplotlib/tests/test_text.py:241–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

239
240
241def test_annotation_contains():
242 # Check that Annotation.contains looks at the bboxes of the text and the
243 # arrow separately, not at the joint bbox.
244 fig, ax = plt.subplots()
245 ann = ax.annotate(
246 "hello", xy=(.4, .4), xytext=(.6, .6), arrowprops={"arrowstyle": "->"})
247 fig.canvas.draw() # Needed for the same reason as in test_contains.
248 event = MouseEvent(
249 "button_press_event", fig.canvas, *ax.transData.transform((.5, .6)))
250 assert ann.contains(event) == (False, {})
251
252
253@pytest.mark.parametrize('err, xycoords, match', (

Callers

nothing calls this directly

Calls 6

MouseEventClass · 0.90
annotateMethod · 0.80
subplotsMethod · 0.45
drawMethod · 0.45
transformMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…