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
tests: fix altair autosize test (#6981)
Myles Scolnick1e3f78338d30
diff --git a/tests/_plugins/ui/_impl/test_altair_chart.py b/tests/_plugins/ui/_impl/test_altair_chart.pyindex 58ad61738a..e8cf20242c 100644--- a/tests/_plugins/ui/_impl/test_altair_chart.py+++ b/tests/_plugins/ui/_impl/test_altair_chart.py@@ -1176,19 +1176,22 @@ def test_autosize_not_applied_with_nested_hconcat() -> None:chart1 = alt.Chart(data).mark_point().encode(x="x", y="y")chart2 = alt.Chart(data).mark_line().encode(x="x", y="y")+ def get_autosize(chart: dict[str, Any]) -> str | None:+ return chart.get("autosize")+# Test 1: VConcatChart with nested HConcatChart should NOT have autosize appliedhconcat_chart = alt.hconcat(chart1, chart2)vconcat_with_hconcat = alt.vconcat(hconcat_chart, chart1)marimo_chart = altair_chart(vconcat_with_hconcat)# The autosize should remain Undefined (not set to "fit-x")- assert marimo_chart._chart.autosize is alt.Undefined+ assert get_autosize(marimo_chart._spec) is None# Test 2: Simple VConcatChart (no nested hconcat) SHOULD have autosize appliedsimple_vconcat = alt.vconcat(chart1, chart2)marimo_chart_simple = altair_chart(simple_vconcat)# The autosize should be set to "fit-x"- assert marimo_chart_simple._chart.autosize == "fit-x"+ assert get_autosize(marimo_chart_simple._spec) == "fit-x"# Test 3: VConcatChart with nested vconcat containing hconcat should NOT have autosizenested_with_hconcat = alt.vconcat(@@ -1196,7 +1199,7 @@ def test_autosize_not_applied_with_nested_hconcat() -> None:)marimo_chart_complex = altair_chart(nested_with_hconcat)- assert marimo_chart_complex._chart.autosize is alt.Undefined+ assert get_autosize(marimo_chart_complex._spec) is None# Test 4: VConcatChart with explicit autosize should not be overriddenvconcat_with_autosize = alt.vconcat(chart1, chart2).properties(@@ -1204,4 +1207,4 @@ def test_autosize_not_applied_with_nested_hconcat() -> None:)marimo_chart_explicit = altair_chart(vconcat_with_autosize)# Should keep the explicit autosize value- assert marimo_chart_explicit._chart.autosize == "none"+ assert get_autosize(marimo_chart_explicit._spec) == "none"