A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
mock theme for test (#6266)
Shahmir Varqha8496f4a12a87
diff --git a/frontend/src/core/ai/context/providers/__tests__/cell-output.test.ts b/frontend/src/core/ai/context/providers/__tests__/cell-output.test.tsindex 796fdc9559..fa87c4e5af 100644--- a/frontend/src/core/ai/context/providers/__tests__/cell-output.test.ts+++ b/frontend/src/core/ai/context/providers/__tests__/cell-output.test.ts@@ -144,7 +144,9 @@ describe("CellOutputContextProvider", () => {const items = provider.getItems();const textItem = items.find((item) => item.data.cellId === "cell1");- if (!textItem) throw new Error("Text item not found");+ if (!textItem) {+ throw new Error("Text item not found");+ }const context = provider.formatContext(textItem);@@ -160,7 +162,9 @@ describe("CellOutputContextProvider", () => {const items = provider.getItems();const mediaItem = items.find((item) => item.data.cellId === "cell2");- if (!mediaItem) throw new Error("Media item not found");+ if (!mediaItem) {+ throw new Error("Media item not found");+ }const context = provider.formatContext(mediaItem);diff --git a/tests/_data/test_charts.py b/tests/_data/test_charts.pyindex b1e19a3411..5040a19ab7 100644--- a/tests/_data/test_charts.py+++ b/tests/_data/test_charts.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport astfrom datetime import datetimefrom typing import Any+from unittest.mock import patchimport pytest@@ -38,6 +39,13 @@ HAS_DEPS = ()+def mock_light_theme():+ """Mock the theme to always return 'light' for consistent test results."""+ with patch("marimo._data.charts.get_current_theme", return_value="light"):+ yield++def test_get_chart_builder():for t, should_limit_to_10_items in TYPES:assert isinstance(@@ -63,6 +71,7 @@ def validate_and_return_codes(simple: bool) -> list[str]:return outputs[email protected]("mock_light_theme")def test_charts_altair_code():outputs = validate_and_return_codes(simple=True)snapshot("charts.txt", "\n\n".join(outputs))@@ -97,6 +106,7 @@ def test_charts_altair_code_with_comment():@pytest.mark.skipif(not HAS_DEPS, reason="optional dependencies not installed")[email protected]("mock_light_theme")def test_charts_altair_json():outputs: list[str] = []import altair as alt@@ -116,6 +126,7 @@ def test_charts_altair_json():@pytest.mark.skipif(not HAS_DEPS, reason="optional dependencies not installed")[email protected]("mock_light_theme")def test_charts_altair_json_bad_data():import altair as altimport pandas as pddiff --git a/tests/_data/test_preview_column.py b/tests/_data/test_preview_column.pyindex be888cc650..5c8ae7a765 100644--- a/tests/_data/test_preview_column.py+++ b/tests/_data/test_preview_column.py@@ -32,6 +32,13 @@ HAS_SQL_DEPS = (snapshot = snapshotter(__file__)+def mock_light_theme():+ """Mock the theme to always return 'light' for consistent test results."""+ with patch("marimo._data.charts.get_current_theme", return_value="light"):+ yield++# Run cleanup after all tests are done@pytest.fixture(scope="module", autouse=True)def cleanup() -> Generator[None, None, None]:@@ -83,6 +90,7 @@ def test_get_column_preview_for_dataframe() -> None:not HAS_DF_DEPS, reason="optional dependencies not installed")@pytest.mark.skipif(is_windows(), reason="Windows encodes base64 differently")[email protected]("mock_light_theme")@pytest.mark.parametrize(("column_name", "snapshot_prefix"),[@@ -211,6 +219,7 @@ def test_get_column_preview_for_duckdb() -> None:not HAS_SQL_DEPS, reason="optional dependencies not installed")@pytest.mark.skipif(is_windows(), reason="Windows encodes base64 differently")[email protected]("mock_light_theme")def test_get_column_preview_for_duckdb_categorical() -> None:import duckdb