Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecated call to resize_event in test #2443

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions glue/utils/tests/test_matplotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from matplotlib.artist import Artist
from numpy.testing import assert_allclose
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backend_bases import ResizeEvent

from glue.tests.helpers import requires_scipy, requires_skimage
from glue.utils.misc import DeferredMethod
Expand Down Expand Up @@ -152,7 +153,8 @@ def test_freeze_margins():
# np.testing.assert_allclose(bbox.x1, 0.9)
# np.testing.assert_allclose(bbox.y1, 0.9)

fig.canvas.resize_event()
resize_event = ResizeEvent("resize_event", fig.canvas)
fig.canvas.callbacks.process(resize_event.name, resize_event)

bbox = ax.get_position()
np.testing.assert_allclose(bbox.x0, 0.25)
Expand All @@ -161,7 +163,8 @@ def test_freeze_margins():
np.testing.assert_allclose(bbox.y1, 0.75)

fig.set_size_inches(8, 8)
fig.canvas.resize_event()
resize_event = ResizeEvent("resize_event", fig.canvas)
fig.canvas.callbacks.process(resize_event.name, resize_event)

bbox = ax.get_position()
np.testing.assert_allclose(bbox.x0, 0.125)
Expand All @@ -170,7 +173,8 @@ def test_freeze_margins():
np.testing.assert_allclose(bbox.y1, 0.875)

ax.resizer.margins = [0, 1, 2, 4]
fig.canvas.resize_event()
resize_event = ResizeEvent("resize_event", fig.canvas)
fig.canvas.callbacks.process(resize_event.name, resize_event)

bbox = ax.get_position()
np.testing.assert_allclose(bbox.x0, 0.)
Expand Down