Skip to content

Commit

Permalink
update _fake_click() in test_viz.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rythorpe committed Oct 3, 2023
1 parent 9a86840 commit 9ae9f6b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hnn_core/tests/test_viz.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from functools import partial
import os.path as op

import matplotlib
from matplotlib import backend_bases
import matplotlib.pyplot as plt
import numpy as np
from numpy.testing import assert_allclose
Expand All @@ -19,8 +19,11 @@
def _fake_click(fig, ax, point, button=1):
"""Fake a click at a point within axes."""
x, y = ax.transData.transform_point(point)
func = partial(fig.canvas.button_press_event, x=x, y=y, button=button)
func(guiEvent=None)
button_press_event = backend_bases.MouseEvent(
name='button_press_event', canvas=fig.canvas,
x=x, y=y, button=button
)
fig.canvas.callbacks.process('button_press_event', button_press_event)


def test_network_visualization():
Expand Down

0 comments on commit 9ae9f6b

Please sign in to comment.