| 239 | |
| 240 | |
| 241 | def 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', ( |