Skip to content

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.

tests: fix breaks to polars upgrades (#7454)

Myles Scolnickda325a681f48
diff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py
index 8a3a171bed..f5fdefb4ac 100644
--- a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py
+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py
@@ -144,9 +144,18 @@ def python_print_pandas(
transform.drop_na,
)
# Use explicit aggregation columns if provided, otherwise all except group-by columns
- aggregation_columns = transform.aggregation_column_ids or [
- col for col in all_columns if col not in column_ids
- ]
+ # Filter out group-by columns from aggregation columns to match narwhals behavior
+ group_by_column_id_set = set(column_ids)
+ if transform.aggregation_column_ids:
+ aggregation_columns = [
+ col
+ for col in transform.aggregation_column_ids
+ if col not in group_by_column_id_set
+ ]
+ else:
+ aggregation_columns = [
+ col for col in all_columns if col not in group_by_column_id_set
+ ]
args = _args_list(_list_of_strings(column_ids), f"dropna={drop_na}")
group_by = f"{df_name}.groupby({args})"
# Narwhals adds suffixes to aggregated columns like 'column_count'
@@ -166,22 +175,17 @@ def python_print_pandas(
else:
assert_never(aggregation)
- # If specific aggregation columns are provided, only aggregate those and rename explicitly.
- if aggregation_columns:
- agg_dict = ", ".join(
- f"{_as_literal(f'{col}_{aggregation}')} : ({_as_literal(col)}, {_as_literal(agg_func)})"
- for col in aggregation_columns
- )
- return f"{group_by}.agg(**{{{agg_dict}}}).reset_index()"
+ # If aggregation_columns is empty after filtering, just return unique grouped columns
+ # This matches narwhals behavior when agg() is called with empty list
+ if not aggregation_columns:
+ return f"{df_name}[{_list_of_strings(column_ids)}].drop_duplicates().reset_index(drop=True)"
- # Otherwise, follow pandas default across all applicable columns and suffix the result
- if aggregation in ["mean", "median"]:
- agg_call = f"{group_by}.{agg_func}(numeric_only=True)"
- else:
- agg_call = f"{group_by}.{agg_func}()"
- # Need to escape the f-string properly for the lambda and include the aggregation string literal
- # Use single curly braces in the f-string since we want them in the generated code
- return f"({agg_call}.reset_index().rename(columns=lambda col: col if col in {_list_of_strings(column_ids)} else f'{{col}}_{aggregation}'))"
+ # If specific aggregation columns are provided, only aggregate those and rename explicitly.
+ agg_dict = ", ".join(
+ f"{_as_literal(f'{col}_{aggregation}')} : ({_as_literal(col)}, {_as_literal(agg_func)})"
+ for col in aggregation_columns
+ )
+ return f"{group_by}.agg(**{{{agg_dict}}}).reset_index()"
elif transform.type == TransformType.SELECT_COLUMNS:
column_ids = transform.column_ids
diff --git a/tests/_plugins/ui/_impl/tables/snapshots/polars.download.json b/tests/_plugins/ui/_impl/tables/snapshots/polars.download.json
index ce09062932..430b4e6e61 100644
--- a/tests/_plugins/ui/_impl/tables/snapshots/polars.download.json
+++ b/tests/_plugins/ui/_impl/tables/snapshots/polars.download.json
@@ -1,205 +1,208 @@
[
- {
- "strings": "a",
- "bool": true,
- "int": 1,
- "large_int": {
- "$bigint": "18446744073709551616"
- },
- "float": 1.0,
- "decimals": "1.23",
- "datetime": "2021-01-01 00:00:00",
- "date": "2021-01-01",
- "struct": {
- "a": 1,
- "b": 2
- },
- "list": [
- 1,
- 2
- ],
- "nested_lists": [
- [
- 1,
- 2
- ]
- ],
- "nested_arrays": [
- [
- 1,
- 2
- ]
- ],
- "array": [
- 1
- ],
- "nulls": null,
- "category": "cat",
- "set": [
- 1,
- 2
- ],
- "imaginary": "(1+2j)",
- "time": "12:30:00",
- "duration": "1d",
- "nans":NaN,
- "infs": "inf",
- "mixed_list": [
- "1",
- "two"
- ],
- "structs_with_list": {
- "a": [
- 1,
- 2
- ],
- "b": 2
- },
- "list_with_structs": [
- {
- "a": 1,
- "c": null
- },
- {
- "a": null,
- "c": 3
- }
- ],
- "enum_list": [
- "A",
- "B",
- "C"
- ],
- "binary": "\u0000\u0000\u0000\u0000\u0001\u00c0U\u00e8\u00b1n1\u00c0T@D\u00f1?Bc\u0095\u0083"
+ {
+ "strings": "a",
+ "bool": true,
+ "int": 1,
+ "large_int": {
+ "$bigint": "18446744073709551616"
},
- {
- "strings": "b",
- "bool": false,
- "int": 2,
- "large_int": {
- "$bigint": "36893488147419103233"
- },
- "float": 2.0,
- "decimals": "4.56",
- "datetime": "2021-01-02 00:00:00",
- "date": "2021-01-02",
- "struct": {
- "a": 3,
- "b": 4
- },
- "list": [
- 3,
- 4
- ],
- "nested_lists": [
- [
- 3,
- 4
- ]
- ],
- "nested_arrays": [
- [
- 3,
- 4
- ]
- ],
- "array": [
- 2
- ],
- "nulls": "data",
- "category": "dog",
- "set": [
- 3,
- 4
- ],
- "imaginary": "(3+4j)",
- "time": "13:45:00",
- "duration": "315\u00b5s",
- "nans":NaN,
- "infs": "-inf",
- "mixed_list": [
- "3.0",
- "0.0"
- ],
- "structs_with_list": {
- "a": [
- 3,
- 4
- ],
- "b": 4
- },
- "list_with_structs": [
- {
- "a": null,
- "c": null
- }
- ],
- "enum_list": [
- "A",
- "B",
- "C"
- ],
- "binary": "world"
+ "float": 1.0,
+ "decimals": "1.23",
+ "datetime": "2021-01-01 00:00:00",
+ "date": "2021-01-01",
+ "struct": {
+ "a": 1,
+ "b": 2
},
- {
- "strings": "c",
- "bool": true,
- "int": 3,
- "large_int": {
- "$bigint": "73786976294838206466"
- },
- "float": 3.0,
- "decimals": "7.89",
- "datetime": "2021-01-03 00:00:00",
- "date": "2021-01-03",
- "struct": {
- "a": 5,
- "b": 6
- },
- "list": [
- 5,
- 6
- ],
- "nested_lists": [
- [
- 5,
- 6
- ]
- ],
- "nested_arrays": [
- [
- 5,
- 6
- ]
- ],
- "array": [
- 3
- ],
- "nulls": null,
- "category": "mouse",
- "set": [
- 5,
- 6
- ],
- "imaginary": "(5+6j)",
- "time": "14:15:00",
- "duration": "2h 30m",
- "nans":NaN,
- "infs": "inf",
- "mixed_list": [
- null,
- "2021-01-01 00:00:00.000000"
- ],
- "structs_with_list": {
- "a": null,
- "b": null
- },
- "list_with_structs": [],
- "enum_list": [
- "A",
- "B",
- "C"
- ],
- "binary": "foo"
- }
+ "list": [
+ 1,
+ 2
+ ],
+ "nested_lists": [
+ [
+ 1,
+ 2
+ ]
+ ],
+ "nested_arrays": [
+ [
+ 1,
+ 2
+ ]
+ ],
+ "array": [
+ 1
+ ],
+ "nulls": null,
+ "category": "cat",
+ "set": [
+ 1,
+ 2
+ ],
+ "imaginary": "(1+2j)",
+ "time": "12:30:00",
+ "duration": "1d",
+ "nans":NaN,
+ "infs": "inf",
+ "mixed_list": [
+ "1",
+ "two"
+ ],
+ "structs_with_list": {
+ "a": [
+ 1,
+ 2
+ ],
+ "b": 2
+ },
+ "list_with_structs": [
+ {
+ "a": 1,
+ "c": null,
+ "e": null
+ },
+ {
+ "a": null,
+ "c": 3,
+ "e": null
+ }
+ ],
+ "enum_list": [
+ "A",
+ "B",
+ "C"
+ ],
+ "binary": "\u0000\u0000\u0000\u0000\u0001\u00c0U\u00e8\u00b1n1\u00c0T@D\u00f1?Bc\u0095\u0083"
+ },
+ {
+ "strings": "b",
+ "bool": false,
+ "int": 2,
+ "large_int": {
+ "$bigint": "36893488147419103233"
+ },
+ "float": 2.0,
+ "decimals": "4.56",
+ "datetime": "2021-01-02 00:00:00",
+ "date": "2021-01-02",
+ "struct": {
+ "a": 3,
+ "b": 4
+ },
+ "list": [
+ 3,
+ 4
+ ],
+ "nested_lists": [
+ [
+ 3,
+ 4
+ ]
+ ],
+ "nested_arrays": [
+ [
+ 3,
+ 4
+ ]
+ ],
+ "array": [
+ 2
+ ],
+ "nulls": "data",
+ "category": "dog",
+ "set": [
+ 3,
+ 4
+ ],
+ "imaginary": "(3+4j)",
+ "time": "13:45:00",
+ "duration": "315\u00b5s",
+ "nans":NaN,
+ "infs": "-inf",
+ "mixed_list": [
+ "3.0",
+ "0.0"
+ ],
+ "structs_with_list": {
+ "a": [
+ 3,
+ 4
+ ],
+ "b": 4
+ },
+ "list_with_structs": [
+ {
+ "a": null,
+ "c": null,
+ "e": 5
+ }
+ ],
+ "enum_list": [
+ "A",
+ "B",
+ "C"
+ ],
+ "binary": "world"
+ },
+ {
+ "strings": "c",
+ "bool": true,
+ "int": 3,
+ "large_int": {
+ "$bigint": "73786976294838206466"
+ },
+ "float": 3.0,
+ "decimals": "7.89",
+ "datetime": "2021-01-03 00:00:00",
+ "date": "2021-01-03",
+ "struct": {
+ "a": 5,
+ "b": 6
+ },
+ "list": [
+ 5,
+ 6
+ ],
+ "nested_lists": [
+ [
+ 5,
+ 6
+ ]
+ ],
+ "nested_arrays": [
+ [
+ 5,
+ 6
+ ]
+ ],
+ "array": [
+ 3
+ ],
+ "nulls": null,
+ "category": "mouse",
+ "set": [
+ 5,
+ 6
+ ],
+ "imaginary": "(5+6j)",
+ "time": "14:15:00",
+ "duration": "2h 30m",
+ "nans":NaN,
+ "infs": "inf",
+ "mixed_list": [
+ null,
+ "2021-01-01 00:00:00.000000"
+ ],
+ "structs_with_list": [
+ 5,
+ 6
+ ],
+ "list_with_structs": [],
+ "enum_list": [
+ "A",
+ "B",
+ "C"
+ ],
+ "binary": "foo"
+ }
]
diff --git a/tests/_plugins/ui/_impl/tables/snapshots/polars.field_types.json b/tests/_plugins/ui/_impl/tables/snapshots/polars.field_types.json
index 1d288f334e..c3fce4e0eb 100644
--- a/tests/_plugins/ui/_impl/tables/snapshots/polars.field_types.json
+++ b/tests/_plugins/ui/_impl/tables/snapshots/polars.field_types.json
@@ -1,184 +1,184 @@
[
+ [
+ "strings",
[
- "strings",
- [
- "string",
- "str"
- ]
- ],
- [
- "bool",
- [
- "boolean",
- "bool"
- ]
- ],
- [
- "int",
- [
- "integer",
- "i64"
- ]
- ],
- [
- "large_int",
- [
- "integer",
- "i128"
- ]
- ],
- [
- "float",
- [
- "number",
- "f64"
- ]
- ],
- [
- "decimals",
- [
- "number",
- "decimal[38,2]"
- ]
- ],
- [
- "datetime",
- [
- "datetime",
- "datetime[\u03bcs]"
- ]
- ],
- [
- "date",
- [
- "date",
- "date"
- ]
- ],
- [
- "struct",
- [
- "unknown",
- "struct[2]"
- ]
- ],
- [
- "list",
- [
- "unknown",
- "list[i64]"
- ]
- ],
- [
- "nested_lists",
- [
- "unknown",
- "list[list[i64]]"
- ]
- ],
- [
- "nested_arrays",
- [
- "unknown",
- "array[i64, (1, 2)]"
- ]
- ],
- [
- "array",
- [
- "unknown",
- "array[i64, 1]"
- ]
- ],
- [
- "nulls",
- [
- "string",
- "str"
- ]
- ],
- [
- "category",
- [
- "string",
- "cat"
- ]
- ],
- [
- "set",
- [
- "unknown",
- "object"
- ]
- ],
- [
- "imaginary",
- [
- "unknown",
- "object"
- ]
- ],
- [
- "time",
- [
- "time",
- "time"
- ]
- ],
- [
- "duration",
- [
- "number",
- "duration[\u03bcs]"
- ]
- ],
- [
- "nans",
- [
- "number",
- "f64"
- ]
- ],
- [
- "infs",
- [
- "number",
- "f64"
- ]
- ],
- [
- "mixed_list",
- [
- "unknown",
- "list[str]"
- ]
- ],
- [
- "structs_with_list",
- [
- "unknown",
- "struct[2]"
- ]
- ],
- [
- "list_with_structs",
- [
- "unknown",
- "list[struct[2]]"
- ]
- ],
- [
- "enum_list",
- [
- "unknown",
- "list[enum]"
- ]
- ],
- [
- "binary",
- [
- "unknown",
- "binary"
- ]
- ]
-]
\ No newline at end of file
+ "string",
+ "str"
+ ]
+ ],
+ [
+ "bool",
+ [
+ "boolean",
+ "bool"
+ ]
+ ],
+ [
+ "int",
+ [
+ "integer",
+ "i64"
+ ]
+ ],
+ [
+ "large_int",
+ [
+ "integer",
+ "i128"
+ ]
+ ],
+ [
+ "float",
+ [
+ "number",
+ "f64"
+ ]
+ ],
+ [
+ "decimals",
+ [
+ "number",
+ "decimal[38,2]"
+ ]
+ ],
+ [
+ "datetime",
+ [
+ "datetime",
+ "datetime[\u03bcs]"
+ ]
+ ],
+ [
+ "date",
+ [
+ "date",
+ "date"
+ ]
+ ],
+ [
+ "struct",
+ [
+ "unknown",
+ "struct[2]"
+ ]
+ ],
+ [
+ "list",
+ [
+ "unknown",
+ "list[i64]"
+ ]
+ ],
+ [
+ "nested_lists",
+ [
+ "unknown",
+ "list[list[i64]]"
+ ]
+ ],
+ [
+ "nested_arrays",
+ [
+ "unknown",
+ "array[i64, (1, 2)]"
+ ]
+ ],
+ [
+ "array",
+ [
+ "unknown",
+ "array[i64, 1]"
+ ]
+ ],
+ [
+ "nulls",
+ [
+ "string",
+ "str"
+ ]
+ ],
+ [
+ "category",
+ [
+ "string",
+ "cat"
+ ]
+ ],
+ [
+ "set",
+ [
+ "unknown",
+ "object"
+ ]
+ ],
+ [
+ "imaginary",
+ [
+ "unknown",
+ "object"
+ ]
+ ],
+ [
+ "time",
+ [
+ "time",
+ "time"
+ ]
+ ],
+ [
+ "duration",
+ [
+ "number",
+ "duration[\u03bcs]"
+ ]
+ ],
+ [
+ "nans",
+ [
+ "number",
+ "f64"
+ ]
+ ],
+ [
+ "infs",
+ [
+ "number",
+ "f64"
+ ]
+ ],
+ [
+ "mixed_list",
+ [
+ "unknown",
+ "list[str]"
+ ]
+ ],
+ [
+ "structs_with_list",
+ [
+ "unknown",
+ "object"
+ ]
+ ],
+ [
+ "list_with_structs",
+ [
+ "unknown",
+ "list[struct[3]]"
+ ]
+ ],
+ [
+ "enum_list",
+ [
+ "unknown",
+ "list[enum]"
+ ]
+ ],
+ [
+ "binary",
+ [
+ "unknown",
+ "binary"
+ ]
+ ]
+]
diff --git a/tests/_plugins/ui/_impl/tables/snapshots/polars.json b/tests/_plugins/ui/_impl/tables/snapshots/polars.json
index 3dff8680b0..430b4e6e61 100644
--- a/tests/_plugins/ui/_impl/tables/snapshots/polars.json
+++ b/tests/_plugins/ui/_impl/tables/snapshots/polars.json
@@ -1,205 +1,208 @@
[
- {
- "strings": "a",
- "bool": true,
- "int": 1,
- "large_int": {
- "$bigint": "18446744073709551616"
- },
- "float": 1.0,
- "decimals": "1.23",
- "datetime": "2021-01-01 00:00:00",
- "date": "2021-01-01",
- "struct": {
- "a": 1,
- "b": 2
- },
- "list": [
- 1,
- 2
- ],
- "nested_lists": [
- [
- 1,
- 2
- ]
- ],
- "nested_arrays": [
- [
- 1,
- 2
- ]
- ],
- "array": [
- 1
- ],
- "nulls": null,
- "category": "cat",
- "set": [
- 1,
- 2
- ],
- "imaginary": "(1+2j)",
- "time": "12:30:00",
- "duration": "1d",
- "nans":NaN,
- "infs": "inf",
- "mixed_list": [
- "1",
- "two"
- ],
- "structs_with_list": {
- "a": [
- 1,
- 2
- ],
- "b": 2
- },
- "list_with_structs": [
- {
- "a": 1,
- "c": null
- },
- {
- "a": null,
- "c": 3
- }
- ],
- "enum_list": [
- "A",
- "B",
- "C"
- ],
- "binary": "\u0000\u0000\u0000\u0000\u0001\u00c0U\u00e8\u00b1n1\u00c0T@D\u00f1?Bc\u0095\u0083"
+ {
+ "strings": "a",
+ "bool": true,
+ "int": 1,
+ "large_int": {
+ "$bigint": "18446744073709551616"
},
- {
- "strings": "b",
- "bool": false,
- "int": 2,
- "large_int": {
- "$bigint": "36893488147419103233"
- },
- "float": 2.0,
- "decimals": "4.56",
- "datetime": "2021-01-02 00:00:00",
- "date": "2021-01-02",
- "struct": {
- "a": 3,
- "b": 4
- },
- "list": [
- 3,
- 4
- ],
- "nested_lists": [
- [
- 3,
- 4
- ]
- ],
- "nested_arrays": [
- [
- 3,
- 4
- ]
- ],
- "array": [
- 2
- ],
- "nulls": "data",
- "category": "dog",
- "set": [
- 3,
- 4
- ],
- "imaginary": "(3+4j)",
- "time": "13:45:00",
- "duration": "315\u00b5s",
- "nans":NaN,
- "infs": "-inf",
- "mixed_list": [
- "3.0",
- "0.0"
- ],
- "structs_with_list": {
- "a": [
- 3,
- 4
- ],
- "b": 4
- },
- "list_with_structs": [
- {
- "a": null,
- "c": null
- }
- ],
- "enum_list": [
- "A",
- "B",
- "C"
- ],
- "binary": "world"
+ "float": 1.0,
+ "decimals": "1.23",
+ "datetime": "2021-01-01 00:00:00",
+ "date": "2021-01-01",
+ "struct": {
+ "a": 1,
+ "b": 2
},
- {
- "strings": "c",
- "bool": true,
- "int": 3,
- "large_int": {
- "$bigint": "73786976294838206466"
- },
- "float": 3.0,
- "decimals": "7.89",
- "datetime": "2021-01-03 00:00:00",
- "date": "2021-01-03",
- "struct": {
- "a": 5,
- "b": 6
- },
- "list": [
- 5,
- 6
- ],
- "nested_lists": [
- [
- 5,
- 6
- ]
- ],
- "nested_arrays": [
- [
- 5,
- 6
- ]
- ],
- "array": [
- 3
- ],
- "nulls": null,
- "category": "mouse",
- "set": [
- 5,
- 6
- ],
- "imaginary": "(5+6j)",
- "time": "14:15:00",
- "duration": "2h 30m",
- "nans":NaN,
- "infs": "inf",
- "mixed_list": [
- null,
- "2021-01-01 00:00:00.000000"
- ],
- "structs_with_list": {
- "a": null,
- "b": null
- },
- "list_with_structs": [],
- "enum_list": [
- "A",
- "B",
- "C"
- ],
- "binary": "foo"
- }
-]
\ No newline at end of file
+ "list": [
+ 1,
+ 2
+ ],
+ "nested_lists": [
+ [
+ 1,
+ 2
+ ]
+ ],
+ "nested_arrays": [
+ [
+ 1,
+ 2
+ ]
+ ],
+ "array": [
+ 1
+ ],
+ "nulls": null,
+ "category": "cat",
+ "set": [
+ 1,
+ 2
+ ],
+ "imaginary": "(1+2j)",
+ "time": "12:30:00",
+ "duration": "1d",
+ "nans":NaN,
+ "infs": "inf",
+ "mixed_list": [
+ "1",
+ "two"
+ ],
+ "structs_with_list": {
+ "a": [
+ 1,
+ 2
+ ],
+ "b": 2
+ },
+ "list_with_structs": [
+ {
+ "a": 1,
+ "c": null,
+ "e": null
+ },
+ {
+ "a": null,
+ "c": 3,
+ "e": null
+ }
+ ],
+ "enum_list": [
+ "A",
+ "B",
+ "C"
+ ],
+ "binary": "\u0000\u0000\u0000\u0000\u0001\u00c0U\u00e8\u00b1n1\u00c0T@D\u00f1?Bc\u0095\u0083"
+ },
+ {
+ "strings": "b",
+ "bool": false,
+ "int": 2,
+ "large_int": {
+ "$bigint": "36893488147419103233"
+ },
+ "float": 2.0,
+ "decimals": "4.56",
+ "datetime": "2021-01-02 00:00:00",
+ "date": "2021-01-02",
+ "struct": {
+ "a": 3,
+ "b": 4
+ },
+ "list": [
+ 3,
+ 4
+ ],
+ "nested_lists": [
+ [
+ 3,
+ 4
+ ]
+ ],
+ "nested_arrays": [
+ [
+ 3,
+ 4
+ ]
+ ],
+ "array": [
+ 2
+ ],
+ "nulls": "data",
+ "category": "dog",
+ "set": [
+ 3,
+ 4
+ ],
+ "imaginary": "(3+4j)",
+ "time": "13:45:00",
+ "duration": "315\u00b5s",
+ "nans":NaN,
+ "infs": "-inf",
+ "mixed_list": [
+ "3.0",
+ "0.0"
+ ],
+ "structs_with_list": {
+ "a": [
+ 3,
+ 4
+ ],
+ "b": 4
+ },
+ "list_with_structs": [
+ {
+ "a": null,
+ "c": null,
+ "e": 5
+ }
+ ],
+ "enum_list": [
+ "A",
+ "B",
+ "C"
+ ],
+ "binary": "world"
+ },
+ {
+ "strings": "c",
+ "bool": true,
+ "int": 3,
+ "large_int": {
+ "$bigint": "73786976294838206466"
+ },
+ "float": 3.0,
+ "decimals": "7.89",
+ "datetime": "2021-01-03 00:00:00",
+ "date": "2021-01-03",
+ "struct": {
+ "a": 5,
+ "b": 6
+ },
+ "list": [
+ 5,
+ 6
+ ],
+ "nested_lists": [
+ [
+ 5,
+ 6
+ ]
+ ],
+ "nested_arrays": [
+ [
+ 5,
+ 6
+ ]
+ ],
+ "array": [
+ 3
+ ],
+ "nulls": null,
+ "category": "mouse",
+ "set": [
+ 5,
+ 6
+ ],
+ "imaginary": "(5+6j)",
+ "time": "14:15:00",
+ "duration": "2h 30m",
+ "nans":NaN,
+ "infs": "inf",
+ "mixed_list": [
+ null,
+ "2021-01-01 00:00:00.000000"
+ ],
+ "structs_with_list": [
+ 5,
+ 6
+ ],
+ "list_with_structs": [],
+ "enum_list": [
+ "A",
+ "B",
+ "C"
+ ],
+ "binary": "foo"
+ }
+]
diff --git a/tests/_plugins/ui/_impl/tables/test_narwhals.py b/tests/_plugins/ui/_impl/tables/test_narwhals.py
index ba29ddadd7..e69e15bceb 100644
--- a/tests/_plugins/ui/_impl/tables/test_narwhals.py
+++ b/tests/_plugins/ui/_impl/tables/test_narwhals.py
@@ -394,7 +394,11 @@ class TestNarwhalsTableManagerFactory(unittest.TestCase):
min=datetime.datetime(2021, 1, 1, 0, 0),
max=datetime.datetime(2021, 1, 3, 0, 0),
mean=datetime.datetime(2021, 1, 2, 0, 0),
- # median=datetime.datetime(2021, 1, 2, 0, 0),
+ median=datetime.datetime(2021, 1, 2, 0, 0),
+ p5=datetime.datetime(2021, 1, 1, 0, 0),
+ p25=datetime.datetime(2021, 1, 2, 0, 0),
+ p75=datetime.datetime(2021, 1, 3, 0, 0),
+ p95=datetime.datetime(2021, 1, 3, 0, 0),
)
def test_summary_date(self) -> None:
diff --git a/tests/_plugins/ui/_impl/tables/test_polars_table.py b/tests/_plugins/ui/_impl/tables/test_polars_table.py
index 6f0f78184e..baf4322b6c 100644
--- a/tests/_plugins/ui/_impl/tables/test_polars_table.py
+++ b/tests/_plugins/ui/_impl/tables/test_polars_table.py
@@ -112,6 +112,7 @@ class TestPolarsTableManagerFactory(unittest.TestCase):
"structs_with_list": pl.Series(
"mixed",
[{"a": [1, 2], "b": 2}, {"a": [3, 4], "b": 4}, [5, 6]],
+ strict=False,
),
"list_with_structs": pl.Series(
"list_with_structs",
@@ -120,6 +121,7 @@ class TestPolarsTableManagerFactory(unittest.TestCase):
[{"e": 5}],
[],
],
+ strict=False,
),
"enum_list": pl.Series(
[["A", "B", "C"], ["A", "B", "C"], ["A", "B", "C"]],
@@ -446,9 +448,11 @@ class TestPolarsTableManagerFactory(unittest.TestCase):
min=datetime.datetime(2021, 1, 1, 0, 0),
max=datetime.datetime(2021, 1, 3, 0, 0),
mean=datetime.datetime(2021, 1, 2, 0, 0),
- # TODO: narwhals doesn't support median
- # and polars doesn't support quantiles for dates
- # median=datetime.datetime(2021, 1, 2, 0, 0),
+ median=datetime.datetime(2021, 1, 2, 0, 0),
+ p5=datetime.datetime(2021, 1, 1, 0, 0),
+ p25=datetime.datetime(2021, 1, 2, 0, 0),
+ p75=datetime.datetime(2021, 1, 3, 0, 0),
+ p95=datetime.datetime(2021, 1, 3, 0, 0),
)
def test_stats_date(self) -> None:
diff --git a/tests/_runtime/test_manage_script_metadata.py b/tests/_runtime/test_manage_script_metadata.py
index 33bc9d12b4..9404f8a5c6 100644
--- a/tests/_runtime/test_manage_script_metadata.py
+++ b/tests/_runtime/test_manage_script_metadata.py
@@ -58,7 +58,7 @@ async def test_manage_script_metadata_uv(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert "markdown" not in contents
assert '"os",' not in contents
@@ -67,7 +67,7 @@ async def test_manage_script_metadata_uv(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert '"os",' not in contents
assert '"markdown==' in contents
@@ -76,7 +76,7 @@ async def test_manage_script_metadata_uv(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert '"markdown==' in contents
assert '"os",' not in contents
@@ -108,7 +108,7 @@ async def test_manage_script_metadata_uv_deletion(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert '"os",' not in contents
# Add markdown
@@ -116,7 +116,7 @@ async def test_manage_script_metadata_uv_deletion(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert '"os",' not in contents
assert '"markdown==' in contents
@@ -125,7 +125,7 @@ async def test_manage_script_metadata_uv_deletion(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert '"markdown==' in contents
assert '"os",' not in contents
@@ -134,7 +134,7 @@ async def test_manage_script_metadata_uv_deletion(
with open(filename) as f: # noqa: ASYNC230
contents = f.read()
- assert '"marimo",' in contents
+ assert '"marimo' in contents
assert '"markdown==' in contents
assert '"os",' not in contents