Skip to content

Commit

Permalink
Fixed test to no longer use broken Figure.set_dpi
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Jul 4, 2023
1 parent bbeb744 commit ad19003
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mpl_scatter_density/tests/test_scatter_density_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import MagicMock, Mock
import pytest
import numpy as np
from matplotlib import rc_context
import matplotlib.pyplot as plt

try:
Expand Down Expand Up @@ -218,13 +219,13 @@ def test_downres_ignore_unity(self, tmpdir):

def test_default_dpi(self, tmpdir):

self.fig.set_dpi(90)
a = ScatterDensityArtist(self.ax, self.x1, self.y1, dpi=None)
self.ax.add_artist(a)
# We can't just draw, we need to save, as not all backends actually
# draw when calling figure.canvas.draw()
self.ax.figure.savefig(tmpdir.join('test.png').strpath)
assert a.get_size() == (216, 216)
with rc_context({'savefig.dpi': 90}):
a = ScatterDensityArtist(self.ax, self.x1, self.y1, dpi=None)
self.ax.add_artist(a)
# We can't just draw, we need to save, as not all backends actually
# draw when calling figure.canvas.draw()
self.ax.figure.savefig(tmpdir.join('test.png').strpath)
assert a.get_size() == (216, 216)

def test_downres_ignore_other_tools(self, tmpdir):

Expand Down

0 comments on commit ad19003

Please sign in to comment.