-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Testing for distances specific plotting.""" |
34 changes: 34 additions & 0 deletions
34
aeon/visualisation/distances/tests/test_pairwise_distance_matrix.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Test pairwise distance matrix plotting.""" | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
from aeon.utils.validation._dependencies import _check_soft_dependencies | ||
from aeon.visualisation import plot_pairwise_distance_matrix | ||
|
||
|
||
@pytest.mark.skipif( | ||
not _check_soft_dependencies(["matplotlib", "seaborn"], severity="none"), | ||
reason="skip test if required soft dependency not available", | ||
) | ||
def test_plot_pairwise_distance_matrix(): | ||
"""Test whether plot_pairwise_distance_matrix runs without error.""" | ||
import matplotlib | ||
import matplotlib.pyplot as plt | ||
|
||
matplotlib.use("Agg") | ||
|
||
distance_matrix = np.array([[0.0, 1.0], [1.0, 0.0]]) | ||
a = np.array([1.0, 2.0]) | ||
b = np.array([1.5, 2.5]) | ||
path = [(0, 0), (1, 1)] | ||
|
||
ax = plot_pairwise_distance_matrix(distance_matrix, a, b, path) | ||
fig = plt.gcf() | ||
plt.gcf().canvas.draw_idle() | ||
|
||
assert isinstance(fig, plt.Figure) | ||
assert isinstance(ax, plt.Axes) | ||
assert len(fig.axes) > 0 | ||
|
||
plt.close() |