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.

fix & loosen CI polars test on broken graph (#10358)

Shahmir Varqha0305f5462579
diff --git a/tests/_output/formatters/test_formatters.py b/tests/_output/formatters/test_formatters.py
index c5dfce104f..c53a594858 100644
--- a/tests/_output/formatters/test_formatters.py
+++ b/tests/_output/formatters/test_formatters.py
@@ -3,6 +3,7 @@ from __future__ import annotations
import importlib
import importlib.util
import os.path
+import re
import sys
from typing import Any
from unittest.mock import Mock, patch
@@ -646,13 +647,20 @@ def test_polars_dot_to_mermaid_complex() -> None:
.join(pl.DataFrame({"A": [1]}).lazy(), on="A")
)
+ result = polars_dot_to_mermaid(ldf._ldf.to_dot(optimized=True))
+
+ # Normalize polars' query-plan wording so we assert on the graph structure,
+ # not on the exact wording.
+ result = re.sub(r'FILTER BY .*?(?="\])', "FILTER BY <predicate>", result)
+ result = re.sub(r"π \S+/\d+", "π <n>/<n>", result)
+
assert (
- polars_dot_to_mermaid(ldf._ldf.to_dot(optimized=True))
+ result
== """graph TD
-\tp4["TABLE\nπ */2"]
-\tp3["FILTER BY [(col(#quot;A#quot;)) > (1)]"]
-\tp2["π 2/2"]
-\tp5["TABLE\nπ */1"]
+\tp4["TABLE\nπ <n>/<n>"]
+\tp3["FILTER BY <predicate>"]
+\tp2["π <n>/<n>"]
+\tp5["TABLE\nπ <n>/<n>"]
\tp1["JOIN INNER\nleft: [col(#quot;A#quot;)];\nright: [col(#quot;A#quot;)]"]
\tp2 --> p1
\tp3 --> p2