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.

format: fix breaking formatting on main (#6867)

Dylan Madisettid236bf4a3cdd
diff --git a/marimo/_server/templates/templates.py b/marimo/_server/templates/templates.py
index 95ec81edd1..4259ad0fee 100644
--- a/marimo/_server/templates/templates.py
+++ b/marimo/_server/templates/templates.py
@@ -91,9 +91,7 @@ def _get_mount_config(
"session": {session},
"runtimeConfig": {runtime_config},
}}
-""".format(
- **{k: json_script(v) for k, v in options.items()}
- ).strip()
+""".format(**{k: json_script(v) for k, v in options.items()}).strip()
def home_page_template(
diff --git a/tests/_server/templates/test_templates.py b/tests/_server/templates/test_templates.py
index b11136f1b3..5cebd44ea7 100644
--- a/tests/_server/templates/test_templates.py
+++ b/tests/_server/templates/test_templates.py
@@ -737,7 +737,9 @@ class TestStaticNotebookTemplate(unittest.TestCase):
def test_static_malicious_filename_injection(self) -> None:
"""Test that malicious filenames in static exports are properly escaped."""
- malicious_filepath = self.tmp_path / "</script><script>alert(1)</script>.py"
+ malicious_filepath = (
+ self.tmp_path / "</script><script>alert(1)</script>.py"
+ )
result = templates.static_notebook_template(
self.html,
@@ -755,7 +757,9 @@ class TestStaticNotebookTemplate(unittest.TestCase):
# Must not contain unescaped script tags
assert "</script><script>" not in result
- assert "<script>alert(1)" not in result.replace("\\u003Cscript\\u003E", "")
+ assert "<script>alert(1)" not in result.replace(
+ "\\u003Cscript\\u003E", ""
+ )
# Must contain escaped versions in JSON context
assert "\\u003C" in result or "\\u003E" in result
diff --git a/tests/_server/test_templates_filename.py b/tests/_server/test_templates_filename.py
index 449ad3aae9..dfd103eaf9 100644
--- a/tests/_server/test_templates_filename.py
+++ b/tests/_server/test_templates_filename.py
@@ -124,7 +124,11 @@ class TestJsonScriptEscaping:
# Must contain escaped versions of dangerous chars
# json_script escapes <, >, & to \uXXXX format
if "<" in payload or ">" in payload or "&" in payload:
- assert "\\u003C" in result or "\\u003E" in result or "\\u0026" in result
+ assert (
+ "\\u003C" in result
+ or "\\u003E" in result
+ or "\\u0026" in result
+ )
# Must be valid JSON that round-trips correctly
parsed = json.loads(result)
@@ -181,9 +185,9 @@ class TestJsonScriptEscaping:
# Combining characters
{"text": "e\u0301"}, # é as combining character
# Right-to-left marks
- {"text": "\u200F"},
+ {"text": "\u200f"},
# Zero-width characters
- {"text": "test\u200Bword"},
+ {"text": "test\u200bword"},
],
)
def test_unicode_handling(self, data: dict) -> None: