The "Как сайт" look by default, also in TikTok's settings and all their sub-pages, where every item is its own rounded row. The bottom bar floats as an island, 9:16 videos reach under it, the seek bar is lifted, thicker and on by default, the comment input is an island too, and "only sound" downloads are saved as audio. The LihonT agent: a chat that makes cards and slides for a photo post, looks things up on the web, signs in with Telegram and has a daily limit on the server. Also the нейронка.рус landing page and the 3D-phone promo scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.3 KiB
Python
66 lines
2.3 KiB
Python
"""Run the reading of the model's own slides on a real JVM."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCES = [ROOT / "src" / "lihont" / "two" / "agent" / "CardPlan.java", ROOT / "src" / "lihont" / "two" / "agent" / "SlidePlan.java"]
|
|
HARNESS = ROOT / "tests" / "java" / "lihont" / "two" / "agent" / "SlidePlanTest.java"
|
|
|
|
|
|
class SlidePlanTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.javac = shutil.which("javac")
|
|
cls.java = shutil.which("java")
|
|
if not cls.javac or not cls.java:
|
|
raise RuntimeError("Slide plan tests require a JDK with java and javac")
|
|
cls.temporary = tempfile.TemporaryDirectory(prefix="lihont-slides-tests-")
|
|
cls.addClassCleanup(cls.temporary.cleanup)
|
|
cls.classes = Path(cls.temporary.name) / "classes"
|
|
cls.classes.mkdir()
|
|
cls.environment = dict(os.environ)
|
|
cls.environment.pop("JAVA_TOOL_OPTIONS", None)
|
|
cls.run_command([
|
|
cls.javac, "--release", "17", "-encoding", "UTF-8", "-Xlint:all", "-Werror",
|
|
"-d", str(cls.classes), *[str(s) for s in SOURCES], str(HARNESS),
|
|
])
|
|
|
|
@classmethod
|
|
def run_command(cls, command):
|
|
result = subprocess.run(command, capture_output=True, text=True, encoding="utf-8",
|
|
env=cls.environment, timeout=120)
|
|
if result.returncode:
|
|
raise AssertionError(f"Command failed with exit {result.returncode}: {command[0]}\n"
|
|
+ result.stdout + result.stderr)
|
|
return result
|
|
|
|
def run_scenario(self, name):
|
|
result = self.run_command([self.java, "-Dfile.encoding=UTF-8", "-cp", str(self.classes),
|
|
"lihont.two.agent.SlidePlanTest", name])
|
|
self.assertEqual(result.stdout.strip(), "PASS " + name)
|
|
|
|
def test_a_full_answer(self):
|
|
self.run_scenario("basic")
|
|
|
|
def test_what_the_model_leaves_out(self):
|
|
self.run_scenario("defaults")
|
|
|
|
def test_limits(self):
|
|
self.run_scenario("limits")
|
|
|
|
def test_written_line_breaks_and_small_text(self):
|
|
self.run_scenario("breaks")
|
|
|
|
def test_rubbish_gives_no_slides(self):
|
|
self.run_scenario("rubbish")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|