Skip to content

Commit b6f03a1

Browse files
Fix testing to properly support rc releases
of matplotlib. Remove depreciated apis from tests.
1 parent 471f3e8 commit b6f03a1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

matplotview/tests/test_view_obj.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ def test_obj_comparison():
1010
from matplotlib.axes import Subplot, Axes
1111
import matplotlib
1212

13-
mpl_version = tuple(int(v) for v in matplotlib.__version__.split("."))
13+
mpl_version = tuple(int(v) for v in matplotlib.__version__.split(".")[:2])
1414

1515
view_class1 = view_wrapper(Subplot)
1616
view_class2 = view_wrapper(Subplot)
1717
view_class3 = view_wrapper(Axes)
1818

1919
assert view_class1 is view_class2
2020
assert view_class1 == view_class2
21-
if(mpl_version >= (3, 7, 0)):
22-
# As of 3.7.0, the subplot class no long exists, and is an alias to the Axes class...
21+
if(mpl_version >= (3, 7)):
22+
# As of 3.7.0, the subplot class no longer exists, and is an alias to the Axes class...
2323
assert view_class2 == view_class3
2424
else:
2525
assert view_class2 != view_class3

matplotview/tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
def figure_to_image(figure):
66
figure.canvas.draw()
7-
img = np.frombuffer(figure.canvas.tostring_rgb(), dtype=np.uint8)
8-
return img.reshape(figure.canvas.get_width_height()[::-1] + (3,))
7+
img = np.frombuffer(figure.canvas.buffer_rgba(), dtype=np.uint8)
8+
return img.reshape(figure.canvas.get_width_height()[::-1] + (4,))[..., :3]
99

1010

1111
def matches_post_pickle(figure):

0 commit comments

Comments
 (0)