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: health and repr tests (#4007)
Myles Scolnicke6fd07ccecbf
diff --git a/tests/_server/api/endpoints/test_export.py b/tests/_server/api/endpoints/test_export.pyindex f6c66d1b18..1cf6499198 100644--- a/tests/_server/api/endpoints/test_export.py+++ b/tests/_server/api/endpoints/test_export.py@@ -13,6 +13,7 @@ from marimo import __version__from marimo._dependencies.dependencies import DependencyManagerfrom marimo._output.utils import uri_encode_componentfrom marimo._types.ids import SessionId+from marimo._utils.platform import is_windowsfrom tests._server.conftest import get_session_managerfrom tests._server.mocks import (token_header,@@ -343,7 +344,8 @@ def test_auto_export_ipynb(@pytest.mark.skipif(- not DependencyManager.nbformat.has(), reason="nbformat not installed"+ not DependencyManager.nbformat.has() or is_windows(),+ reason="nbformat not installed or on Windows",)@with_session(SESSION_ID)def test_auto_export_ipynb_with_new_cell(diff --git a/tests/_utils/test_health_utils.py b/tests/_utils/test_health_utils.pynew file mode 100644index 0000000000..5fa20536a0--- /dev/null+++ b/tests/_utils/test_health_utils.py@@ -0,0 +1,34 @@+from __future__ import annotations++from marimo._utils.health import (+ _get_versions,+ get_chrome_version,+ get_node_version,+ get_optional_modules_list,+ get_python_version,+ get_required_modules_list,+)+++def test_get_node_version_exists():+ get_node_version()+++def test_get_required_modules_list():+ assert isinstance(get_required_modules_list(), dict)+++def test_get_optional_modules_list():+ assert isinstance(get_optional_modules_list(), dict)+++def test_get_versions():+ assert isinstance(_get_versions(list(), False), dict)+++def test_get_chrome_version():+ get_chrome_version()+++def test_get_python_version():+ assert isinstance(get_python_version(), str)diff --git a/tests/_utils/test_repr.py b/tests/_utils/test_repr.pynew file mode 100644index 0000000000..c318b345a3--- /dev/null+++ b/tests/_utils/test_repr.py@@ -0,0 +1,42 @@+from __future__ import annotations++from marimo._utils.repr import format_repr+++def test_format_repr_with_simple_values() -> None:+ """Test format_repr with basic value types."""++ class TestClass:+ pass++ obj = TestClass()+ items = {"a": 1, "b": "hello", "c": True}++ result = format_repr(obj, items)++ assert result == "TestClass(a=1, b=hello, c=True)"+++def test_format_repr_with_empty_items() -> None:+ """Test format_repr with an empty items dict."""++ class TestClass:+ pass++ obj = TestClass()+ result = format_repr(obj, {})++ assert result == "TestClass()"+++def test_format_repr_with_none_values() -> None:+ """Test format_repr with None values."""++ class TestClass:+ pass++ obj = TestClass()+ items = {"a": None, "b": "hello"}+ result = format_repr(obj, items)++ assert result == "TestClass(a=None, b=hello)"