Skip to content

Commit

Permalink
Add test for PointCollection.plot()
Browse files Browse the repository at this point in the history
  • Loading branch information
stefmolin committed May 14, 2023
1 parent ad24e18 commit 07118c6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/shapes/bases/test_point_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import re

import matplotlib.pyplot as plt
import pytest

from data_morph.shapes.bases.point_collection import PointCollection
Expand Down Expand Up @@ -35,3 +36,10 @@ def test_repr(self, point_collection):
re.match(r'^<PointCollection of \d* points>$', 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

0 comments on commit 07118c6

Please sign in to comment.