diff --git a/tests/test_heatmap.py b/tests/test_heatmap.py index fb04949..56c795e 100644 --- a/tests/test_heatmap.py +++ b/tests/test_heatmap.py @@ -51,6 +51,12 @@ def plot_4(): return fig +def plot_5(): + fig = px.imshow([[1, 20, 30], + [20, 1, 60], + [30, 60, 1]]) + fig.data[0].z = None + return fig def test_1(): assert_equality(plot_1(), os.path.join(this_dir, test_name, test_name + "_1_reference.tex"), img_name="/tmp/tikzplotly/fig1.png") @@ -62,4 +68,7 @@ def test_3(): assert_equality(plot_3(), os.path.join(this_dir, test_name, test_name + "_3_reference.tex"), img_name="/tmp/tikzplotly/fig3.png") def test_4(): - assert_equality(plot_4(), os.path.join(this_dir, test_name, test_name + "_4_reference.tex"), img_name="/tmp/tikzplotly/fig4.png") \ No newline at end of file + assert_equality(plot_4(), os.path.join(this_dir, test_name, test_name + "_4_reference.tex"), img_name="/tmp/tikzplotly/fig4.png") + +def test_5(): + assert_equality(plot_5(), os.path.join(this_dir, test_name, test_name + "_5_reference.tex")) \ No newline at end of file diff --git a/tests/test_heatmap/test_heatmap_5_reference.tex b/tests/test_heatmap/test_heatmap_5_reference.tex new file mode 100644 index 0000000..3365d0f --- /dev/null +++ b/tests/test_heatmap/test_heatmap_5_reference.tex @@ -0,0 +1,9 @@ +\begin{tikzpicture} + + +\begin{axis}[ +y dir=reverse +] +\addplot coordinates {}; +\end{axis} +\end{tikzpicture} diff --git a/tests/test_markers.py b/tests/test_markers.py index 86a1f9f..7296901 100644 --- a/tests/test_markers.py +++ b/tests/test_markers.py @@ -1,5 +1,6 @@ import plotly.express as px import plotly.graph_objects as go +import pytest import numpy as np import os from .helpers import assert_equality @@ -8,30 +9,18 @@ this_dir = pathlib.Path(__file__).resolve().parent test_name = "test_markers" -def plot_1(): +def plot_1(symbol): df = px.data.iris() fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species") fig.update_traces(marker=dict(size=12, + symbol = symbol, line=dict(width=2, color='DarkSlateGrey')), selector=dict(mode='markers')) return fig -def plot_1_bis(): - - df = px.data.iris() - fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species") - - fig.update_traces(marker=dict(size=12, - symbol = "1", - line=dict(width=2, - color='DarkSlateGrey')), - selector=dict(mode='markers')) - return fig - - def plot_2(): np.random.seed(1) x = np.random.uniform(low=3, high=6, size=(500,)) @@ -92,11 +81,9 @@ def plot_3(): return fig -def test_1(): - assert_equality(plot_1(), os.path.join(this_dir, test_name, test_name + "_1_reference.tex")) - -def test_1_bis(): - assert_equality(plot_1_bis(), os.path.join(this_dir, test_name, test_name + "_1_bis_reference.tex")) +@pytest.mark.parametrize("symbol", ["circle", 0, "0"]) +def test_1(symbol): + assert_equality(plot_1(symbol), os.path.join(this_dir, test_name, test_name + "_1_reference.tex")) def test_2(): assert_equality(plot_2(), os.path.join(this_dir, test_name, test_name + "_2_reference.tex")) diff --git a/tests/test_markers/test_markers_1_bis_reference.tex b/tests/test_markers/test_markers_1_bis_reference.tex deleted file mode 100644 index a87b932..0000000 --- a/tests/test_markers/test_markers_1_bis_reference.tex +++ /dev/null @@ -1,176 +0,0 @@ -\pgfplotstableread{data0 setosa -3.5 5.1 -3.0 4.9 -3.2 4.7 -3.1 4.6 -3.6 5.0 -3.9 5.4 -3.4 4.6 -3.4 5.0 -2.9 4.4 -3.1 4.9 -3.7 5.4 -3.4 4.8 -3.0 4.8 -3.0 4.3 -4.0 5.8 -4.4 5.7 -3.9 5.4 -3.5 5.1 -3.8 5.7 -3.8 5.1 -3.4 5.4 -3.7 5.1 -3.6 4.6 -3.3 5.1 -3.4 4.8 -3.0 5.0 -3.4 5.0 -3.5 5.2 -3.4 5.2 -3.2 4.7 -3.1 4.8 -3.4 5.4 -4.1 5.2 -4.2 5.5 -3.1 4.9 -3.2 5.0 -3.5 5.5 -3.1 4.9 -3.0 4.4 -3.4 5.1 -3.5 5.0 -2.3 4.5 -3.2 4.4 -3.5 5.0 -3.8 5.1 -3.0 4.8 -3.8 5.1 -3.2 4.6 -3.7 5.3 -3.3 5.0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}{HTML}{EF553B} -\definecolor{darkslategrey}{RGB}{47, 79, 79} - -\begin{axis}[ -xlabel=sepal\_width, -ylabel=sepal\_length -] -\addplot+ [mark=square*, only marks, mark size=9, mark options={solid, fill=636efa, draw=darkslategrey, line width=1.5}] table[y=setosa] {\dataZ}; -\addlegendentry{setosa} -\addplot+ [mark=square*, only marks, mark size=9, mark options={solid, fill=EF553B, draw=darkslategrey, line width=1.5}] table[y=versicolor] {\dataO}; -\addlegendentry{versicolor} -\addplot+ [mark=square*, only marks, mark size=9, mark options={solid, fill=00cc96, draw=darkslategrey, line width=1.5}] table[y=virginica] {\dataT}; -\addlegendentry{virginica} -\end{axis} -\end{tikzpicture} diff --git a/tests/test_tikzplotly.py b/tests/test_tikzplotly.py index a9cf994..a3b9f89 100644 --- a/tests/test_tikzplotly.py +++ b/tests/test_tikzplotly.py @@ -3,4 +3,4 @@ def test_tikzplotly(): fig = px.scatter(x=[1, 2, 3], y=[1, 2, 3]) - tikzplotly.save("/tmp/test_tikzplotly.tex", fig) \ No newline at end of file + tikzplotly.save("/tmp/tikzplotly/test_tikzplotly.tex", fig) \ No newline at end of file