Skip to content

Commit

Permalink
Refactor test_PlotSSA_instantiation for compatibility with python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
dadelforge committed Nov 5, 2024
1 parent 05373be commit 1446267
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@


def test_PlotSSA_instantiation():
with pytest.raises(TypeError,
match="Can't instantiate abstract class PlotSSA with "
"abstract methods _reconstruct_group_matrix, "
"_reconstruct_group_timeseries, to_frame"):
"""Test that PlotSSA cannot be instantiated as it's an abstract class."""
with pytest.raises(TypeError) as excinfo:
PlotSSA()

# Check that the error message mentions all required abstract methods
error_msg = str(excinfo.value)
assert all(method in error_msg for method in [
'_reconstruct_group_matrix',
'_reconstruct_group_timeseries',
'to_frame'
]), "Error message should mention all abstract methods"


@pytest.mark.parametrize("abstract_method, concrete_method", [
(PlotSSA.to_frame, SingularSpectrumAnalysis.to_frame),
Expand Down

0 comments on commit 1446267

Please sign in to comment.