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
Fix flaky hypothesis test for pandas GROUP_BY transforms (#7563)
Trevor Manz8193a0e17806
diff --git a/marimo/_internal/__init__.py b/marimo/_internal/__init__.pyindex a5aec03e68..08c6bd3a77 100644--- a/marimo/_internal/__init__.py+++ b/marimo/_internal/__init__.py@@ -1,3 +1,4 @@+# Copyright 2025 Marimo. All rights reserved."""Internal API - DO NOT USE."""import marimo._internal.templates as templatesdiff --git a/tests/_plugins/ui/_impl/dataframes/test_print_code.py b/tests/_plugins/ui/_impl/dataframes/test_print_code.pyindex 323a006327..f1c22628f3 100644--- a/tests/_plugins/ui/_impl/dataframes/test_print_code.py+++ b/tests/_plugins/ui/_impl/dataframes/test_print_code.py@@ -422,11 +422,21 @@ def test_print_code_result_matches_actual_transform_pandas(code_result = code_result.to_frame()if isinstance(real_result, pd.Series):real_result = real_result.to_frame()- # Remove index to compare- pd.testing.assert_frame_equal(- cast(pd.DataFrame, code_result).reset_index(drop=True),- real_result.reset_index(drop=True),- )++ code_result = cast(pd.DataFrame, code_result).reset_index(drop=True)+ real_result = real_result.reset_index(drop=True)++ # For group_by transforms, the row order might differ+ # Sort both dataframes by all columns before comparing+ if transform.type == TransformType.GROUP_BY:+ code_result = code_result.sort_values(+ by=list(code_result.columns)+ ).reset_index(drop=True)+ real_result = real_result.sort_values(+ by=list(real_result.columns)+ ).reset_index(drop=True)++ pd.testing.assert_frame_equal(code_result, real_result)@given(