From 5523c536601d2abe68f06228a806a6b26d207d64 Mon Sep 17 00:00:00 2001 From: NeurArk Date: Thu, 22 May 2025 14:19:44 +0200 Subject: [PATCH] Fix pair plot download and add regression test --- pages/data_explorer.py | 2 +- tests/test_pages.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pages/data_explorer.py b/pages/data_explorer.py index 25962de..c76c5de 100644 --- a/pages/data_explorer.py +++ b/pages/data_explorer.py @@ -139,7 +139,7 @@ def _corr(df): with tempfile.NamedTemporaryFile(suffix=f".{export_fmt}") as tmp: viz.export_figure(fig_pair, Path(tmp.name)) tmp.seek(0) - st.download_button( + st.download_button( "Download Plot", data=tmp.read(), file_name=f"pair_plot.{export_fmt}", diff --git a/tests/test_pages.py b/tests/test_pages.py index 1d8f391..bd321bf 100644 --- a/tests/test_pages.py +++ b/tests/test_pages.py @@ -76,6 +76,18 @@ def test_data_explorer_visualization_widgets_exist(): assert "Generate Heatmap" in content +def test_pair_plot_export(tmp_path): + df = pd.DataFrame({ + "a": [1, 2, 3, 4], + "b": [4, 3, 2, 1], + "cat": ["x", "y", "x", "y"], + }) + fig = viz.pair_plot(df, columns=["a", "b"], hue="cat") + out_file = tmp_path / "pair.png" + viz.export_figure(fig, out_file) + assert out_file.exists() and out_file.stat().st_size > 0 + + def test_time_series_page_runs(monkeypatch): import streamlit as st from pages import time_series