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>
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
"""Run the reading of the model's web requests on a real JVM."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE = ROOT / "src" / "lihont" / "two" / "agent" / "ToolCalls.java"
|
|
HARNESS = ROOT / "tests" / "java" / "lihont" / "two" / "agent" / "ToolCallsTest.java"
|
|
|
|
|
|
class ToolCallsTest(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("Tool call tests require a JDK with java and javac")
|
|
cls.temporary = tempfile.TemporaryDirectory(prefix="lihont-tools-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(SOURCE), 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.ToolCallsTest", name])
|
|
self.assertEqual(result.stdout.strip(), "PASS " + name)
|
|
|
|
def test_the_forms_of_a_request(self):
|
|
self.run_scenario("parsing")
|
|
|
|
def test_limits_and_blocks(self):
|
|
self.run_scenario("limits")
|
|
|
|
def test_requests_are_cut_from_what_is_shown(self):
|
|
self.run_scenario("stripping")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|