File size: 1,122 Bytes
b67c03f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | from pathlib import Path
from src.worker_payload import UNIVERSAL_MODEL_CARD_WORKER_SCRIPT, encoded_universal_model_card_worker_script
def test_universal_payload_compiles():
compile(UNIVERSAL_MODEL_CARD_WORKER_SCRIPT, "<universal_worker>", "exec")
def test_universal_payload_encoded():
assert encoded_universal_model_card_worker_script()
def test_universal_initial_workspace_renders_without_name_error(tmp_path):
namespace = {}
exec(compile(UNIVERSAL_MODEL_CARD_WORKER_SCRIPT, "<universal_worker>", "exec"), namespace)
workspace = tmp_path / "workspace"
files = namespace["create_initial_workspace"](
workspace,
"Tongyi-MAI/Z-Image-Turbo",
"fffiloni/test-space",
"cpu-basic",
"",
False,
"full-inference-gated",
{"pipeline_tag": "text-to-image", "library_name": "diffusers", "tags": [], "siblings": []},
)
assert "app.py" in files
app_py = (workspace / "app.py").read_text(encoding="utf-8")
assert "MODEL_ID = 'Tongyi-MAI/Z-Image-Turbo'" in app_py
assert "{MODEL_ID}" in app_py
assert "GOAL.md" in files
|