From 07118c6ffee0b9fe532b309130b1418e572f19f9 Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Sun, 14 May 2023 18:46:48 -0400 Subject: [PATCH] Add test for PointCollection.plot() --- tests/shapes/bases/test_point_collection.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/shapes/bases/test_point_collection.py b/tests/shapes/bases/test_point_collection.py index 25951d29..7715b1c6 100644 --- a/tests/shapes/bases/test_point_collection.py +++ b/tests/shapes/bases/test_point_collection.py @@ -2,6 +2,7 @@ import re +import matplotlib.pyplot as plt import pytest from data_morph.shapes.bases.point_collection import PointCollection @@ -35,3 +36,10 @@ def test_repr(self, point_collection): re.match(r'^$', repr(point_collection)) is not None ) + + @pytest.mark.parametrize('ax', [None, plt.subplots()[1]]) + def test_plot(self, point_collection, ax): + """Test that plotting is working.""" + ax = point_collection.plot(ax) + assert len(ax.collections[0].get_offsets().data) == len(point_collection.points) + assert pytest.approx(ax.get_aspect()) == 1.0