Rebrand sexp → sx across web platform (173 files)
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 11m37s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 11m37s
Rename all sexp directories, files, identifiers, and references to sx. artdag/ excluded (separate media processing DSL). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,12 +74,12 @@ class TestFreeze:
|
||||
"blog": "https://blog.rose-ash.com",
|
||||
"market": "https://market.rose-ash.com",
|
||||
},
|
||||
"features": ["sexp", "federation"],
|
||||
"features": ["sx", "federation"],
|
||||
"limits": {"max_upload": 10485760},
|
||||
}
|
||||
frozen = _freeze(raw)
|
||||
assert frozen["app_urls"]["blog"] == "https://blog.rose-ash.com"
|
||||
assert frozen["features"] == ("sexp", "federation")
|
||||
assert frozen["features"] == ("sx", "federation")
|
||||
with pytest.raises(TypeError):
|
||||
frozen["app_urls"]["blog"] = "changed"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""Tests for the render() function and component loading in jinja_bridge.
|
||||
|
||||
These test functionality added in recent commits (render() API,
|
||||
load_sexp_dir, snake→kebab conversion) that isn't covered by the existing
|
||||
shared/sexp/tests/test_jinja_bridge.py.
|
||||
load_sx_dir, snake→kebab conversion) that isn't covered by the existing
|
||||
shared/sx/tests/test_jinja_bridge.py.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -11,10 +11,10 @@ import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from shared.sexp.jinja_bridge import (
|
||||
from shared.sx.jinja_bridge import (
|
||||
render,
|
||||
register_components,
|
||||
load_sexp_dir,
|
||||
load_sx_dir,
|
||||
_COMPONENT_ENV,
|
||||
)
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestRender:
|
||||
assert render("pill", text="Hi") == render("~pill", text="Hi")
|
||||
|
||||
def test_snake_to_kebab_conversion(self):
|
||||
"""Python snake_case kwargs should map to sexp kebab-case params."""
|
||||
"""Python snake_case kwargs should map to sx kebab-case params."""
|
||||
register_components('''
|
||||
(defcomp ~card (&key nav-html link-href)
|
||||
(div :class "card" (a :href link-href nav-html)))
|
||||
@@ -95,52 +95,52 @@ class TestRender:
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# load_sexp_dir
|
||||
# load_sx_dir
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestLoadSexpDir:
|
||||
def test_loads_sexp_files(self):
|
||||
class TestLoadSxDir:
|
||||
def test_loads_sx_files(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
# Write a .sexp file
|
||||
with open(os.path.join(tmpdir, "components.sexp"), "w") as f:
|
||||
# Write a .sx file
|
||||
with open(os.path.join(tmpdir, "components.sx"), "w") as f:
|
||||
f.write('(defcomp ~test-comp (&key msg) (div msg))')
|
||||
|
||||
load_sexp_dir(tmpdir)
|
||||
load_sx_dir(tmpdir)
|
||||
html = render("test-comp", msg="loaded!")
|
||||
assert html == "<div>loaded!</div>"
|
||||
|
||||
def test_loads_sexpr_files(self):
|
||||
def test_loads_sx_files_alt(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with open(os.path.join(tmpdir, "nav.sexpr"), "w") as f:
|
||||
with open(os.path.join(tmpdir, "nav.sx"), "w") as f:
|
||||
f.write('(defcomp ~nav-item (&key href label) (a :href href label))')
|
||||
|
||||
load_sexp_dir(tmpdir)
|
||||
load_sx_dir(tmpdir)
|
||||
html = render("nav-item", href="/about", label="About")
|
||||
assert 'href="/about"' in html
|
||||
|
||||
def test_loads_multiple_files(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with open(os.path.join(tmpdir, "a.sexp"), "w") as f:
|
||||
with open(os.path.join(tmpdir, "a.sx"), "w") as f:
|
||||
f.write('(defcomp ~comp-a (&key x) (b x))')
|
||||
with open(os.path.join(tmpdir, "b.sexp"), "w") as f:
|
||||
with open(os.path.join(tmpdir, "b.sx"), "w") as f:
|
||||
f.write('(defcomp ~comp-b (&key y) (i y))')
|
||||
|
||||
load_sexp_dir(tmpdir)
|
||||
load_sx_dir(tmpdir)
|
||||
assert render("comp-a", x="A") == "<b>A</b>"
|
||||
assert render("comp-b", y="B") == "<i>B</i>"
|
||||
|
||||
def test_empty_directory(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
load_sexp_dir(tmpdir) # should not raise
|
||||
load_sx_dir(tmpdir) # should not raise
|
||||
|
||||
def test_ignores_non_sexp_files(self):
|
||||
def test_ignores_non_sx_files(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with open(os.path.join(tmpdir, "readme.txt"), "w") as f:
|
||||
f.write("not a sexp file")
|
||||
with open(os.path.join(tmpdir, "comp.sexp"), "w") as f:
|
||||
f.write("not a sx file")
|
||||
with open(os.path.join(tmpdir, "comp.sx"), "w") as f:
|
||||
f.write('(defcomp ~real (&key v) (span v))')
|
||||
|
||||
load_sexp_dir(tmpdir)
|
||||
load_sx_dir(tmpdir)
|
||||
assert "~real" in _COMPONENT_ENV
|
||||
# txt file should not have been loaded
|
||||
assert len([k for k in _COMPONENT_ENV if k.startswith("~")]) == 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Tests for shared sexp helper functions (call_url, get_asset_url, etc.)."""
|
||||
"""Tests for shared sx helper functions (call_url, get_asset_url, etc.)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from shared.sexp.helpers import call_url, get_asset_url
|
||||
from shared.sx.helpers import call_url, get_asset_url
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user