-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
c236882
commit 94e3644
Showing
4 changed files
with
39 additions
and
74 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
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
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
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 |
---|---|---|
@@ -1,63 +1,28 @@ | ||
import pandas as pd | ||
import numpy as np | ||
|
||
import pytest | ||
|
||
from plotly.graph_objs._figure import Figure | ||
|
||
from ms_mint.plotly_tools import ( | ||
set_template, | ||
plotly_heatmap, | ||
) | ||
|
||
|
||
def test__plotly_heatmap(): | ||
N = 10 | ||
data = np.random.uniform(size=(N, N)) + np.arange(N) - N / 2 | ||
df = pd.DataFrame(data) | ||
img = plotly_heatmap(df) | ||
assert isinstance(img, Figure), type(img) | ||
|
||
|
||
def test__plotly_heatmap__transposed(): | ||
N = 10 | ||
data = np.random.uniform(size=(N, N)) + np.arange(N) - N / 2 | ||
df = pd.DataFrame(data) | ||
img = plotly_heatmap(df, transposed=True) | ||
assert isinstance(img, Figure), type(img) | ||
|
||
|
||
def test__plotly_heatmap__normed_by_cols(): | ||
N = 10 | ||
data = np.random.uniform(size=(N, N)) + np.arange(N) - N / 2 | ||
df = pd.DataFrame(data) | ||
img = plotly_heatmap(df, normed_by_cols=True) | ||
assert isinstance(img, Figure), type(img) | ||
|
||
|
||
def test__plotly_heatmap__correlation(): | ||
@pytest.mark.parametrize("transposed,normed_by_cols,correlation,clustered,add_dendrogram", [ | ||
(False, False, False, False, False), | ||
(True, False, False, False, False), | ||
(False, True, False, False, False), | ||
(False, False, True, False, False), | ||
(False, False, False, True, True), | ||
(False, False, True, True, False), | ||
]) | ||
def test__plotly_heatmap(transposed, normed_by_cols, correlation, clustered, add_dendrogram): | ||
N = 10 | ||
data = np.random.uniform(size=(N, N)) + np.arange(N) - N / 2 | ||
df = pd.DataFrame(data) | ||
img = plotly_heatmap(df, correlation=True) | ||
img = plotly_heatmap(df, transposed=transposed, normed_by_cols=normed_by_cols, correlation=correlation, clustered=clustered, add_dendrogram=add_dendrogram) | ||
assert isinstance(img, Figure), type(img) | ||
|
||
|
||
def test__plotly_heatmap__clustered_with_dendrogram(): | ||
N = 10 | ||
data = np.random.uniform(size=(N, N)) + np.arange(N) - N / 2 | ||
df = pd.DataFrame(data) | ||
img = plotly_heatmap(df, clustered=True, add_dendrogram=True) | ||
assert isinstance(img, Figure), type(img) | ||
|
||
|
||
def test__plotly_heatmap__clustered_correlation(): | ||
N = 10 | ||
data = np.random.uniform(size=(N, N)) + np.arange(N) - N / 2 | ||
df = pd.DataFrame(data) | ||
img = plotly_heatmap(df, clustered=True, add_dendrogram=False, correlation=True) | ||
assert isinstance(img, Figure), type(img) | ||
|
||
|
||
def test__set_template(): | ||
set_template() | ||
assert True | ||
assert True |