@@ -1176,32 +1176,35 @@ def test_autosize_not_applied_with_nested_hconcat() -> None:
11761176 chart1 = alt .Chart (data ).mark_point ().encode (x = "x" , y = "y" )
11771177 chart2 = alt .Chart (data ).mark_line ().encode (x = "x" , y = "y" )
11781178
1179+ def get_autosize (chart : dict [str , Any ]) -> str | None :
1180+ return chart .get ("autosize" )
1181+
11791182 # Test 1: VConcatChart with nested HConcatChart should NOT have autosize applied
11801183 hconcat_chart = alt .hconcat (chart1 , chart2 )
11811184 vconcat_with_hconcat = alt .vconcat (hconcat_chart , chart1 )
11821185
11831186 marimo_chart = altair_chart (vconcat_with_hconcat )
11841187 # The autosize should remain Undefined (not set to "fit-x")
1185- assert marimo_chart ._chart . autosize is alt . Undefined
1188+ assert get_autosize ( marimo_chart ._spec ) is None
11861189
11871190 # Test 2: Simple VConcatChart (no nested hconcat) SHOULD have autosize applied
11881191 simple_vconcat = alt .vconcat (chart1 , chart2 )
11891192 marimo_chart_simple = altair_chart (simple_vconcat )
11901193 # The autosize should be set to "fit-x"
1191- assert marimo_chart_simple ._chart . autosize == "fit-x"
1194+ assert get_autosize ( marimo_chart_simple ._spec ) == "fit-x"
11921195
11931196 # Test 3: VConcatChart with nested vconcat containing hconcat should NOT have autosize
11941197 nested_with_hconcat = alt .vconcat (
11951198 alt .vconcat (chart1 , hconcat_chart ), chart2
11961199 )
11971200
11981201 marimo_chart_complex = altair_chart (nested_with_hconcat )
1199- assert marimo_chart_complex ._chart . autosize is alt . Undefined
1202+ assert get_autosize ( marimo_chart_complex ._spec ) is None
12001203
12011204 # Test 4: VConcatChart with explicit autosize should not be overridden
12021205 vconcat_with_autosize = alt .vconcat (chart1 , chart2 ).properties (
12031206 autosize = "none"
12041207 )
12051208 marimo_chart_explicit = altair_chart (vconcat_with_autosize )
12061209 # Should keep the explicit autosize value
1207- assert marimo_chart_explicit ._chart . autosize == "none"
1210+ assert get_autosize ( marimo_chart_explicit ._spec ) == "none"
0 commit comments