Compare commits
1 Commits
burn/667-1
...
fix/536
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3359e1bae |
81
docs/BEZALEL_EVENNIA_WORLD.md
Normal file
81
docs/BEZALEL_EVENNIA_WORLD.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Bezalel Evennia World
|
||||
|
||||
Issue: `timmy-home#536`
|
||||
|
||||
This is the themed-room world plan and build scaffold for Bezalel, the forge-and-testbed wizard.
|
||||
|
||||
## Rooms
|
||||
|
||||
| Room | Description focus | Core connections |
|
||||
|------|-------------------|------------------|
|
||||
| Limbo | the threshold between houses | Gatehouse |
|
||||
| Gatehouse | guarded entry, travel runes, proof before trust | Limbo, Great Hall, The Portal Room |
|
||||
| Great Hall | three-house maps, reports, shared table | Gatehouse, The Library of Bezalel, The Observatory, The Workshop |
|
||||
| The Library of Bezalel | manuals, bridge schematics, technical memory | Great Hall |
|
||||
| The Observatory | long-range signals toward Mac, VPS, and the wider net | Great Hall |
|
||||
| The Workshop | forge + workbench, plans turned into working form | Great Hall, The Server Room, The Garden of Code |
|
||||
| The Server Room | humming racks, heartbeat of the house | The Workshop |
|
||||
| The Garden of Code | contemplative grove where ideas root before implementation | The Workshop |
|
||||
| The Portal Room | three shimmering doorways aimed at Mac, VPS, and the net | Gatehouse |
|
||||
|
||||
## Characters
|
||||
|
||||
| Character | Role | Starting room |
|
||||
|-----------|------|---------------|
|
||||
| Timmy | quiet builder and observer | Gatehouse |
|
||||
| Bezalel | forge-and-testbed wizard | The Workshop |
|
||||
| Marcus | old man with kind eyes, human warmth in the system | The Garden of Code |
|
||||
| Kimi | scholar of context and meaning | The Library of Bezalel |
|
||||
|
||||
## Themed items
|
||||
|
||||
At least one durable item is placed in every major room, including:
|
||||
- Threshold Ledger
|
||||
- Three-House Map
|
||||
- Bridge Schematics
|
||||
- Compiler Manuals
|
||||
- Tri-Axis Telescope
|
||||
- Forge Anvil
|
||||
- Bridge Workbench
|
||||
- Heartbeat Console
|
||||
- Server Racks
|
||||
- Code Orchard
|
||||
- Stone Bench
|
||||
- Mac/VPS/Net portal markers
|
||||
|
||||
## Portal travel commands
|
||||
|
||||
The Portal Room reserves three live command names:
|
||||
- `mac`
|
||||
- `vps`
|
||||
- `net`
|
||||
|
||||
Current behavior in the build scaffold:
|
||||
- each command is created as a real Evennia exit command
|
||||
- each command preserves explicit target metadata (`Mac house`, `VPS house`, `Wider net`)
|
||||
- until cross-world transport is wired, each portal routes through `Limbo`, the inter-world threshold room
|
||||
|
||||
This keeps the command surface real now while leaving honest room for later world-to-world linking.
|
||||
|
||||
## Build script
|
||||
|
||||
```bash
|
||||
python3 scripts/evennia/build_bezalel_world.py --plan
|
||||
```
|
||||
|
||||
Inside an Evennia shell / runtime with the repo on `PYTHONPATH`, the same script can build the world idempotently:
|
||||
|
||||
```bash
|
||||
python3 scripts/evennia/build_bezalel_world.py --password bezalel-world-dev
|
||||
```
|
||||
|
||||
What it does:
|
||||
- creates or updates all 9 rooms
|
||||
- creates the exit graph
|
||||
- creates themed objects
|
||||
- creates or rehomes account-backed characters
|
||||
- creates the portal command exits with target metadata
|
||||
|
||||
## Persistence note
|
||||
|
||||
The scaffold is written to be idempotent: rerunning the builder updates descriptions, destinations, and locations rather than creating duplicate world entities. That is the repo-side prerequisite for persistence across Evennia restarts.
|
||||
190
evennia_tools/bezalel_layout.py
Normal file
190
evennia_tools/bezalel_layout.py
Normal file
@@ -0,0 +1,190 @@
|
||||
from collections import deque
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RoomSpec:
|
||||
key: str
|
||||
desc: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ExitSpec:
|
||||
source: str
|
||||
key: str
|
||||
destination: str
|
||||
aliases: tuple[str, ...] = ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ObjectSpec:
|
||||
key: str
|
||||
location: str
|
||||
desc: str
|
||||
aliases: tuple[str, ...] = ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CharacterSpec:
|
||||
key: str
|
||||
desc: str
|
||||
starting_room: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class TravelCommandSpec:
|
||||
key: str
|
||||
aliases: tuple[str, ...]
|
||||
target_world: str
|
||||
fallback_room: str
|
||||
desc: str
|
||||
|
||||
|
||||
ROOMS = (
|
||||
RoomSpec(
|
||||
"Limbo",
|
||||
"The void between worlds. The air carries the pulse of three houses: Mac, VPS, and this one. "
|
||||
"Everything begins here before it is given form.",
|
||||
),
|
||||
RoomSpec(
|
||||
"Gatehouse",
|
||||
"A stone guard tower at the edge of Bezalel's world. The walls are carved with runes of travel, "
|
||||
"proof, and return. Every arrival is weighed before it is trusted.",
|
||||
),
|
||||
RoomSpec(
|
||||
"Great Hall",
|
||||
"A vast hall with a long working table. Maps of the three houses hang beside sketches, benchmarks, "
|
||||
"and deployment notes. This is where the forge reports back to the house.",
|
||||
),
|
||||
RoomSpec(
|
||||
"The Library of Bezalel",
|
||||
"Shelves of technical manuals, Evennia code, test logs, and bridge schematics rise to the ceiling. "
|
||||
"This room holds plans waiting to be made real.",
|
||||
),
|
||||
RoomSpec(
|
||||
"The Observatory",
|
||||
"A high chamber with telescopes pointing toward the Mac, the VPS, and the wider net. Screens glow with "
|
||||
"status lights, latency traces, and long-range signals.",
|
||||
),
|
||||
RoomSpec(
|
||||
"The Workshop",
|
||||
"A forge and workbench share the same heat. Scattered here are half-finished bridges, patched harnesses, "
|
||||
"and tools laid out for proof before pride.",
|
||||
),
|
||||
RoomSpec(
|
||||
"The Server Room",
|
||||
"Racks of humming servers line the walls. Fans push warm air through the chamber while status LEDs beat "
|
||||
"like a mechanical heart. This is the pulse of Bezalel's house.",
|
||||
),
|
||||
RoomSpec(
|
||||
"The Garden of Code",
|
||||
"A quiet garden where ideas are left long enough to grow roots. Code-shaped leaves flutter in patterned wind, "
|
||||
"and a stone path invites patient thought.",
|
||||
),
|
||||
RoomSpec(
|
||||
"The Portal Room",
|
||||
"Three shimmering doorways stand in a ring: one marked for the Mac house, one for the VPS, and one for the wider net. "
|
||||
"The room hums like a bridge waiting for traffic.",
|
||||
),
|
||||
)
|
||||
|
||||
EXITS = (
|
||||
ExitSpec("Limbo", "gatehouse", "Gatehouse", ("gate", "tower")),
|
||||
ExitSpec("Gatehouse", "limbo", "Limbo", ("void", "back")),
|
||||
ExitSpec("Gatehouse", "greathall", "Great Hall", ("hall", "great hall")),
|
||||
ExitSpec("Great Hall", "gatehouse", "Gatehouse", ("gate", "tower")),
|
||||
ExitSpec("Great Hall", "library", "The Library of Bezalel", ("books", "study")),
|
||||
ExitSpec("The Library of Bezalel", "hall", "Great Hall", ("great hall", "back")),
|
||||
ExitSpec("Great Hall", "observatory", "The Observatory", ("telescope", "tower top")),
|
||||
ExitSpec("The Observatory", "hall", "Great Hall", ("great hall", "back")),
|
||||
ExitSpec("Great Hall", "workshop", "The Workshop", ("forge", "bench")),
|
||||
ExitSpec("The Workshop", "hall", "Great Hall", ("great hall", "back")),
|
||||
ExitSpec("The Workshop", "serverroom", "The Server Room", ("servers", "server room")),
|
||||
ExitSpec("The Server Room", "workshop", "The Workshop", ("forge", "bench")),
|
||||
ExitSpec("The Workshop", "garden", "The Garden of Code", ("garden of code", "grove")),
|
||||
ExitSpec("The Garden of Code", "workshop", "The Workshop", ("forge", "bench")),
|
||||
ExitSpec("Gatehouse", "portalroom", "The Portal Room", ("portal", "portals")),
|
||||
ExitSpec("The Portal Room", "gatehouse", "Gatehouse", ("gate", "back")),
|
||||
)
|
||||
|
||||
OBJECTS = (
|
||||
ObjectSpec("Threshold Ledger", "Gatehouse", "A heavy ledger where arrivals, departures, and field notes are recorded before the work begins."),
|
||||
ObjectSpec("Three-House Map", "Great Hall", "A long map showing Mac, VPS, and remote edges in one continuous line of work."),
|
||||
ObjectSpec("Bridge Schematics", "The Library of Bezalel", "Rolled plans describing world bridges, Evennia layouts, and deployment paths."),
|
||||
ObjectSpec("Compiler Manuals", "The Library of Bezalel", "Manuals annotated in the margins with warnings against cleverness without proof."),
|
||||
ObjectSpec("Tri-Axis Telescope", "The Observatory", "A brass telescope assembly that can be turned toward the Mac, the VPS, or the open net."),
|
||||
ObjectSpec("Forge Anvil", "The Workshop", "Scarred metal used for turning rough plans into testable form."),
|
||||
ObjectSpec("Bridge Workbench", "The Workshop", "A wide bench covered in harness patches, relay notes, and half-soldered bridge parts."),
|
||||
ObjectSpec("Heartbeat Console", "The Server Room", "A monitoring console showing service health, latency, and the steady hum of the house."),
|
||||
ObjectSpec("Server Racks", "The Server Room", "Stacked machines that keep the world awake even when no one is watching."),
|
||||
ObjectSpec("Code Orchard", "The Garden of Code", "Trees with code-shaped leaves. Some branches bear elegant abstractions; others hold broken prototypes."),
|
||||
ObjectSpec("Stone Bench", "The Garden of Code", "A place to sit long enough for a hard implementation problem to become clear."),
|
||||
ObjectSpec("Mac Portal", "The Portal Room", "A silver doorway whose frame vibrates with the local sovereign house.", ("mac arch",)),
|
||||
ObjectSpec("VPS Portal", "The Portal Room", "A cobalt doorway tuned toward the testbed VPS house.", ("vps arch",)),
|
||||
ObjectSpec("Net Portal", "The Portal Room", "A pale doorway pointed toward the wider net and every uncertain edge beyond it.", ("net arch", "network arch")),
|
||||
)
|
||||
|
||||
CHARACTERS = (
|
||||
CharacterSpec("Timmy", "The Builder's first creation. Quiet, observant, already measuring the room before he speaks.", "Gatehouse"),
|
||||
CharacterSpec("Bezalel", "The forge-and-testbed wizard. Scarred hands, steady gaze, the habit of proving things before trusting them.", "The Workshop"),
|
||||
CharacterSpec("Marcus", "An old man with kind eyes. He walks like someone who has already survived the night once.", "The Garden of Code"),
|
||||
CharacterSpec("Kimi", "The deep scholar of context and meaning. He carries long memory like a lamp.", "The Library of Bezalel"),
|
||||
)
|
||||
|
||||
PORTAL_COMMANDS = (
|
||||
TravelCommandSpec(
|
||||
"mac",
|
||||
("macbook", "local"),
|
||||
"Mac house",
|
||||
"Limbo",
|
||||
"Align with the sovereign local house. Until live cross-world transport is wired, the command resolves into Limbo — the threshold between houses.",
|
||||
),
|
||||
TravelCommandSpec(
|
||||
"vps",
|
||||
("testbed", "house"),
|
||||
"VPS house",
|
||||
"Limbo",
|
||||
"Step toward the forge VPS. For now the command lands in Limbo, preserving the inter-world threshold until real linking is live.",
|
||||
),
|
||||
TravelCommandSpec(
|
||||
"net",
|
||||
("network", "wider-net"),
|
||||
"Wider net",
|
||||
"Limbo",
|
||||
"Face the open network. The command currently routes through Limbo so the direction exists before the final bridge does.",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def room_keys() -> tuple[str, ...]:
|
||||
return tuple(room.key for room in ROOMS)
|
||||
|
||||
|
||||
def character_keys() -> tuple[str, ...]:
|
||||
return tuple(character.key for character in CHARACTERS)
|
||||
|
||||
|
||||
def portal_command_keys() -> tuple[str, ...]:
|
||||
return tuple(command.key for command in PORTAL_COMMANDS)
|
||||
|
||||
|
||||
def grouped_exits() -> dict[str, tuple[ExitSpec, ...]]:
|
||||
grouped: dict[str, list[ExitSpec]] = {}
|
||||
for exit_spec in EXITS:
|
||||
grouped.setdefault(exit_spec.source, []).append(exit_spec)
|
||||
return {key: tuple(value) for key, value in grouped.items()}
|
||||
|
||||
|
||||
def reachable_rooms_from(start: str) -> set[str]:
|
||||
seen: set[str] = set()
|
||||
queue: deque[str] = deque([start])
|
||||
exits_by_room = grouped_exits()
|
||||
while queue:
|
||||
current = queue.popleft()
|
||||
if current in seen:
|
||||
continue
|
||||
seen.add(current)
|
||||
for exit_spec in exits_by_room.get(current, ()):
|
||||
if exit_spec.destination not in seen:
|
||||
queue.append(exit_spec.destination)
|
||||
return seen
|
||||
@@ -1,290 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Codebase Test Generator — Fill Coverage Gaps (#667)."""
|
||||
|
||||
import ast
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
|
||||
|
||||
@dataclass
|
||||
class FunctionInfo:
|
||||
name: str
|
||||
module_path: str
|
||||
class_name: Optional[str] = None
|
||||
lineno: int = 0
|
||||
args: List[str] = field(default_factory=list)
|
||||
is_async: bool = False
|
||||
is_private: bool = False
|
||||
is_property: bool = False
|
||||
docstring: Optional[str] = None
|
||||
has_return: bool = False
|
||||
raises: List[str] = field(default_factory=list)
|
||||
decorators: List[str] = field(default_factory=list)
|
||||
|
||||
@property
|
||||
def qualified_name(self):
|
||||
if self.class_name:
|
||||
return f"{self.class_name}.{self.name}"
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def test_name(self):
|
||||
safe_mod = self.module_path.replace("/", "_").replace(".py", "").replace("-", "_")
|
||||
safe_cls = self.class_name + "_" if self.class_name else ""
|
||||
return f"test_{safe_mod}_{safe_cls}{self.name}"
|
||||
|
||||
|
||||
@dataclass
|
||||
class CoverageGap:
|
||||
func: FunctionInfo
|
||||
reason: str
|
||||
test_priority: int
|
||||
|
||||
|
||||
class SourceAnalyzer(ast.NodeVisitor):
|
||||
def __init__(self, module_path: str):
|
||||
self.module_path = module_path
|
||||
self.functions: List[FunctionInfo] = []
|
||||
self._class_stack: List[str] = []
|
||||
|
||||
def visit_ClassDef(self, node):
|
||||
self._class_stack.append(node.name)
|
||||
self.generic_visit(node)
|
||||
self._class_stack.pop()
|
||||
|
||||
def visit_FunctionDef(self, node):
|
||||
self._collect(node, False)
|
||||
self.generic_visit(node)
|
||||
|
||||
def visit_AsyncFunctionDef(self, node):
|
||||
self._collect(node, True)
|
||||
self.generic_visit(node)
|
||||
|
||||
def _collect(self, node, is_async):
|
||||
cls = self._class_stack[-1] if self._class_stack else None
|
||||
args = [a.arg for a in node.args.args if a.arg not in ("self", "cls")]
|
||||
has_ret = any(isinstance(c, ast.Return) and c.value for c in ast.walk(node))
|
||||
raises = []
|
||||
for c in ast.walk(node):
|
||||
if isinstance(c, ast.Raise) and c.exc:
|
||||
if isinstance(c.exc, ast.Call) and isinstance(c.exc.func, ast.Name):
|
||||
raises.append(c.exc.func.id)
|
||||
decos = []
|
||||
for d in node.decorator_list:
|
||||
if isinstance(d, ast.Name): decos.append(d.id)
|
||||
elif isinstance(d, ast.Attribute): decos.append(d.attr)
|
||||
self.functions.append(FunctionInfo(
|
||||
name=node.name, module_path=self.module_path, class_name=cls,
|
||||
lineno=node.lineno, args=args, is_async=is_async,
|
||||
is_private=node.name.startswith("_") and not node.name.startswith("__"),
|
||||
is_property="property" in decos,
|
||||
docstring=ast.get_docstring(node), has_return=has_ret,
|
||||
raises=raises, decorators=decos))
|
||||
|
||||
|
||||
def analyze_file(filepath, base_dir):
|
||||
module_path = os.path.relpath(filepath, base_dir)
|
||||
try:
|
||||
with open(filepath, "r", errors="replace") as f:
|
||||
tree = ast.parse(f.read(), filename=filepath)
|
||||
except (SyntaxError, UnicodeDecodeError):
|
||||
return []
|
||||
a = SourceAnalyzer(module_path)
|
||||
a.visit(tree)
|
||||
return a.functions
|
||||
|
||||
|
||||
def find_source_files(source_dir):
|
||||
exclude = {"__pycache__", ".git", "venv", ".venv", "node_modules", ".tox", "build", "dist"}
|
||||
files = []
|
||||
for root, dirs, fs in os.walk(source_dir):
|
||||
dirs[:] = [d for d in dirs if d not in exclude and not d.startswith(".")]
|
||||
for f in fs:
|
||||
if f.endswith(".py") and f != "__init__.py" and not f.startswith("test_"):
|
||||
files.append(os.path.join(root, f))
|
||||
return sorted(files)
|
||||
|
||||
|
||||
def find_existing_tests(test_dir):
|
||||
existing = set()
|
||||
for root, dirs, fs in os.walk(test_dir):
|
||||
for f in fs:
|
||||
if f.startswith("test_") and f.endswith(".py"):
|
||||
try:
|
||||
with open(os.path.join(root, f)) as fh:
|
||||
tree = ast.parse(fh.read())
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, ast.FunctionDef) and node.name.startswith("test_"):
|
||||
existing.add(node.name)
|
||||
except (SyntaxError, UnicodeDecodeError):
|
||||
pass
|
||||
return existing
|
||||
|
||||
|
||||
def identify_gaps(functions, existing_tests):
|
||||
gaps = []
|
||||
for func in functions:
|
||||
if func.name.startswith("__") and func.name != "__init__":
|
||||
continue
|
||||
covered = func.name in str(existing_tests)
|
||||
if not covered:
|
||||
pri = 3 if func.is_private else (1 if (func.raises or func.has_return) else 2)
|
||||
gaps.append(CoverageGap(func=func, reason="no test found", test_priority=pri))
|
||||
gaps.sort(key=lambda g: (g.test_priority, g.func.module_path, g.func.name))
|
||||
return gaps
|
||||
|
||||
|
||||
def generate_test(gap):
|
||||
func = gap.func
|
||||
lines = []
|
||||
lines.append(f" # AUTO-GENERATED -- review before merging")
|
||||
lines.append(f" # Source: {func.module_path}:{func.lineno}")
|
||||
lines.append(f" # Function: {func.qualified_name}")
|
||||
lines.append("")
|
||||
mod_imp = func.module_path.replace("/", ".").replace("-", "_").replace(".py", "")
|
||||
|
||||
call_args = []
|
||||
for a in func.args:
|
||||
if a in ("self", "cls"): continue
|
||||
if "path" in a or "file" in a or "dir" in a: call_args.append(f"{a}='/tmp/test'")
|
||||
elif "name" in a: call_args.append(f"{a}='test'")
|
||||
elif "id" in a or "key" in a: call_args.append(f"{a}='test_id'")
|
||||
elif "message" in a or "text" in a: call_args.append(f"{a}='test msg'")
|
||||
elif "count" in a or "num" in a or "size" in a: call_args.append(f"{a}=1")
|
||||
elif "flag" in a or "enabled" in a or "verbose" in a: call_args.append(f"{a}=False")
|
||||
else: call_args.append(f"{a}=None")
|
||||
args_str = ", ".join(call_args)
|
||||
|
||||
if func.is_async:
|
||||
lines.append(" @pytest.mark.asyncio")
|
||||
lines.append(f" def {func.test_name}(self):")
|
||||
lines.append(f' """Test {func.qualified_name} -- auto-generated."""')
|
||||
|
||||
if func.class_name:
|
||||
lines.append(f" try:")
|
||||
lines.append(f" from {mod_imp} import {func.class_name}")
|
||||
if func.is_private:
|
||||
lines.append(f" pytest.skip('Private method')")
|
||||
elif func.is_property:
|
||||
lines.append(f" obj = {func.class_name}()")
|
||||
lines.append(f" _ = obj.{func.name}")
|
||||
else:
|
||||
if func.raises:
|
||||
lines.append(f" with pytest.raises(({', '.join(func.raises)})):")
|
||||
lines.append(f" {func.class_name}().{func.name}({args_str})")
|
||||
else:
|
||||
lines.append(f" obj = {func.class_name}()")
|
||||
lines.append(f" result = obj.{func.name}({args_str})")
|
||||
if func.has_return:
|
||||
lines.append(f" assert result is not None or result is None # Placeholder")
|
||||
lines.append(f" except ImportError:")
|
||||
lines.append(f" pytest.skip('Module not importable')")
|
||||
else:
|
||||
lines.append(f" try:")
|
||||
lines.append(f" from {mod_imp} import {func.name}")
|
||||
if func.is_private:
|
||||
lines.append(f" pytest.skip('Private function')")
|
||||
else:
|
||||
if func.raises:
|
||||
lines.append(f" with pytest.raises(({', '.join(func.raises)})):")
|
||||
lines.append(f" {func.name}({args_str})")
|
||||
else:
|
||||
lines.append(f" result = {func.name}({args_str})")
|
||||
if func.has_return:
|
||||
lines.append(f" assert result is not None or result is None # Placeholder")
|
||||
lines.append(f" except ImportError:")
|
||||
lines.append(f" pytest.skip('Module not importable')")
|
||||
|
||||
return chr(10).join(lines)
|
||||
|
||||
|
||||
def generate_test_suite(gaps, max_tests=50):
|
||||
by_module = {}
|
||||
for gap in gaps[:max_tests]:
|
||||
by_module.setdefault(gap.func.module_path, []).append(gap)
|
||||
|
||||
lines = []
|
||||
lines.append('"""Auto-generated test suite -- Codebase Genome (#667).')
|
||||
lines.append("")
|
||||
lines.append("Generated by scripts/codebase_test_generator.py")
|
||||
lines.append("Coverage gaps identified from AST analysis.")
|
||||
lines.append("")
|
||||
lines.append("These tests are starting points. Review before merging.")
|
||||
lines.append('"""')
|
||||
lines.append("")
|
||||
lines.append("import pytest")
|
||||
lines.append("from unittest.mock import MagicMock, patch")
|
||||
lines.append("")
|
||||
lines.append("")
|
||||
lines.append("# AUTO-GENERATED -- DO NOT EDIT WITHOUT REVIEW")
|
||||
|
||||
for module, mgaps in sorted(by_module.items()):
|
||||
safe = module.replace("/", "_").replace(".py", "").replace("-", "_")
|
||||
cls_name = "".join(w.title() for w in safe.split("_"))
|
||||
lines.append("")
|
||||
lines.append(f"class Test{cls_name}Generated:")
|
||||
lines.append(f' """Auto-generated tests for {module}."""')
|
||||
for gap in mgaps:
|
||||
lines.append("")
|
||||
lines.append(generate_test(gap))
|
||||
lines.append("")
|
||||
|
||||
return chr(10).join(lines)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Codebase Test Generator")
|
||||
parser.add_argument("--source", default=".")
|
||||
parser.add_argument("--output", default="tests/test_genome_generated.py")
|
||||
parser.add_argument("--max-tests", type=int, default=50)
|
||||
parser.add_argument("--dry-run", action="store_true")
|
||||
parser.add_argument("--include-private", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
source_dir = os.path.abspath(args.source)
|
||||
test_dir = os.path.join(source_dir, "tests")
|
||||
|
||||
print(f"Scanning: {source_dir}")
|
||||
source_files = find_source_files(source_dir)
|
||||
print(f"Source files: {len(source_files)}")
|
||||
|
||||
all_funcs = []
|
||||
for f in source_files:
|
||||
all_funcs.extend(analyze_file(f, source_dir))
|
||||
print(f"Functions/methods: {len(all_funcs)}")
|
||||
|
||||
existing = find_existing_tests(test_dir)
|
||||
print(f"Existing tests: {len(existing)}")
|
||||
|
||||
gaps = identify_gaps(all_funcs, existing)
|
||||
if not args.include_private:
|
||||
gaps = [g for g in gaps if not g.func.is_private]
|
||||
print(f"Coverage gaps: {len(gaps)}")
|
||||
|
||||
by_pri = {1: 0, 2: 0, 3: 0}
|
||||
for g in gaps:
|
||||
by_pri[g.test_priority] += 1
|
||||
print(f" High: {by_pri[1]}, Medium: {by_pri[2]}, Low: {by_pri[3]}")
|
||||
|
||||
if args.dry_run:
|
||||
for g in gaps[:10]:
|
||||
print(f" {g.func.module_path}:{g.func.lineno} {g.func.qualified_name}")
|
||||
return
|
||||
|
||||
if gaps:
|
||||
content = generate_test_suite(gaps, max_tests=args.max-tests if hasattr(args, 'max-tests') else args.max_tests)
|
||||
out = os.path.join(source_dir, args.output)
|
||||
os.makedirs(os.path.dirname(out), exist_ok=True)
|
||||
with open(out, "w") as f:
|
||||
f.write(content)
|
||||
print(f"Generated {min(len(gaps), args.max_tests)} tests -> {args.output}")
|
||||
else:
|
||||
print("No gaps found!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
178
scripts/evennia/build_bezalel_world.py
Normal file
178
scripts/evennia/build_bezalel_world.py
Normal file
@@ -0,0 +1,178 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Idempotent builder for Bezalel's themed Evennia world."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(REPO_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(REPO_ROOT))
|
||||
|
||||
from evennia_tools.bezalel_layout import CHARACTERS, EXITS, OBJECTS, PORTAL_COMMANDS, ROOMS
|
||||
|
||||
|
||||
def describe_build_plan() -> dict:
|
||||
return {
|
||||
"room_count": len(ROOMS),
|
||||
"character_count": len(CHARACTERS),
|
||||
"object_count": len(OBJECTS),
|
||||
"portal_command_count": len(PORTAL_COMMANDS),
|
||||
"room_names": [room.key for room in ROOMS],
|
||||
"character_starts": {character.key: character.starting_room for character in CHARACTERS},
|
||||
"portal_commands": [command.key for command in PORTAL_COMMANDS],
|
||||
}
|
||||
|
||||
|
||||
def _import_evennia_runtime():
|
||||
from evennia.accounts.models import AccountDB
|
||||
from evennia.accounts.accounts import DefaultAccount
|
||||
from evennia.objects.objects import DefaultCharacter, DefaultExit, DefaultObject, DefaultRoom
|
||||
from evennia.utils.create import create_object
|
||||
from evennia.utils.search import search_object
|
||||
|
||||
return {
|
||||
"AccountDB": AccountDB,
|
||||
"DefaultAccount": DefaultAccount,
|
||||
"DefaultCharacter": DefaultCharacter,
|
||||
"DefaultExit": DefaultExit,
|
||||
"DefaultObject": DefaultObject,
|
||||
"DefaultRoom": DefaultRoom,
|
||||
"create_object": create_object,
|
||||
"search_object": search_object,
|
||||
}
|
||||
|
||||
|
||||
def _find_named(search_object, key: str, *, location=None):
|
||||
matches = search_object(key, exact=True)
|
||||
if location is None:
|
||||
return matches[0] if matches else None
|
||||
for match in matches:
|
||||
if getattr(match, "location", None) == location:
|
||||
return match
|
||||
return None
|
||||
|
||||
|
||||
def _ensure_room(runtime, room_spec):
|
||||
room = _find_named(runtime["search_object"], room_spec.key)
|
||||
if room is None:
|
||||
room = runtime["create_object"](runtime["DefaultRoom"], key=room_spec.key)
|
||||
room.db.desc = room_spec.desc
|
||||
room.save()
|
||||
return room
|
||||
|
||||
|
||||
def _ensure_exit(runtime, exit_spec, room_map):
|
||||
source = room_map[exit_spec.source]
|
||||
destination = room_map[exit_spec.destination]
|
||||
existing = _find_named(runtime["search_object"], exit_spec.key, location=source)
|
||||
if existing is None:
|
||||
existing = runtime["create_object"](
|
||||
runtime["DefaultExit"],
|
||||
key=exit_spec.key,
|
||||
aliases=list(exit_spec.aliases),
|
||||
location=source,
|
||||
destination=destination,
|
||||
)
|
||||
else:
|
||||
existing.destination = destination
|
||||
if exit_spec.aliases:
|
||||
existing.aliases.add(list(exit_spec.aliases))
|
||||
existing.save()
|
||||
return existing
|
||||
|
||||
|
||||
def _ensure_object(runtime, object_spec, room_map):
|
||||
location = room_map[object_spec.location]
|
||||
existing = _find_named(runtime["search_object"], object_spec.key, location=location)
|
||||
if existing is None:
|
||||
existing = runtime["create_object"](
|
||||
runtime["DefaultObject"],
|
||||
key=object_spec.key,
|
||||
aliases=list(object_spec.aliases),
|
||||
location=location,
|
||||
home=location,
|
||||
)
|
||||
existing.db.desc = object_spec.desc
|
||||
existing.home = location
|
||||
if existing.location != location:
|
||||
existing.move_to(location, quiet=True, move_hooks=False)
|
||||
existing.save()
|
||||
return existing
|
||||
|
||||
|
||||
def _ensure_character(runtime, character_spec, room_map, password: str):
|
||||
account = runtime["AccountDB"].objects.filter(username__iexact=character_spec.key).first()
|
||||
if account is None:
|
||||
account, errors = runtime["DefaultAccount"].create(username=character_spec.key, password=password)
|
||||
if not account:
|
||||
raise RuntimeError(f"failed to create account for {character_spec.key}: {errors}")
|
||||
character = list(account.characters)[0]
|
||||
start = room_map[character_spec.starting_room]
|
||||
character.db.desc = character_spec.desc
|
||||
character.home = start
|
||||
character.move_to(start, quiet=True, move_hooks=False)
|
||||
character.save()
|
||||
return character
|
||||
|
||||
|
||||
def _ensure_portal_command(runtime, portal_spec, room_map):
|
||||
portal_room = room_map["The Portal Room"]
|
||||
fallback = room_map[portal_spec.fallback_room]
|
||||
existing = _find_named(runtime["search_object"], portal_spec.key, location=portal_room)
|
||||
if existing is None:
|
||||
existing = runtime["create_object"](
|
||||
runtime["DefaultExit"],
|
||||
key=portal_spec.key,
|
||||
aliases=list(portal_spec.aliases),
|
||||
location=portal_room,
|
||||
destination=fallback,
|
||||
)
|
||||
else:
|
||||
existing.destination = fallback
|
||||
if portal_spec.aliases:
|
||||
existing.aliases.add(list(portal_spec.aliases))
|
||||
existing.db.desc = portal_spec.desc
|
||||
existing.db.travel_target = portal_spec.target_world
|
||||
existing.db.portal_stub = True
|
||||
existing.save()
|
||||
return existing
|
||||
|
||||
|
||||
def build_world(password: str = "bezalel-world-dev") -> dict:
|
||||
runtime = _import_evennia_runtime()
|
||||
room_map = {room.key: _ensure_room(runtime, room) for room in ROOMS}
|
||||
for exit_spec in EXITS:
|
||||
_ensure_exit(runtime, exit_spec, room_map)
|
||||
for object_spec in OBJECTS:
|
||||
_ensure_object(runtime, object_spec, room_map)
|
||||
for character_spec in CHARACTERS:
|
||||
_ensure_character(runtime, character_spec, room_map, password=password)
|
||||
for portal_spec in PORTAL_COMMANDS:
|
||||
_ensure_portal_command(runtime, portal_spec, room_map)
|
||||
|
||||
return {
|
||||
"rooms": [room.key for room in ROOMS],
|
||||
"characters": {character.key: character.starting_room for character in CHARACTERS},
|
||||
"portal_commands": {command.key: command.target_world for command in PORTAL_COMMANDS},
|
||||
}
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Build Bezalel's themed Evennia world")
|
||||
parser.add_argument("--plan", action="store_true", help="Print the static build plan without importing Evennia")
|
||||
parser.add_argument("--password", default="bezalel-world-dev", help="Password to use for created account-backed characters")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.plan:
|
||||
print(json.dumps(describe_build_plan(), indent=2))
|
||||
return
|
||||
|
||||
print(json.dumps(build_world(password=args.password), indent=2))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
90
tests/test_bezalel_evennia_layout.py
Normal file
90
tests/test_bezalel_evennia_layout.py
Normal file
@@ -0,0 +1,90 @@
|
||||
import importlib.util
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
LAYOUT_PATH = ROOT / "evennia_tools" / "bezalel_layout.py"
|
||||
BUILD_PATH = ROOT / "scripts" / "evennia" / "build_bezalel_world.py"
|
||||
DOC_PATH = ROOT / "docs" / "BEZALEL_EVENNIA_WORLD.md"
|
||||
|
||||
|
||||
def load_module(path: Path, name: str):
|
||||
assert path.exists(), f"missing {path.relative_to(ROOT)}"
|
||||
spec = importlib.util.spec_from_file_location(name, path)
|
||||
assert spec and spec.loader
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
class TestBezalelEvenniaLayout(unittest.TestCase):
|
||||
def test_room_graph_matches_issue_shape(self):
|
||||
layout = load_module(LAYOUT_PATH, "bezalel_layout")
|
||||
self.assertEqual(
|
||||
layout.room_keys(),
|
||||
(
|
||||
"Limbo",
|
||||
"Gatehouse",
|
||||
"Great Hall",
|
||||
"The Library of Bezalel",
|
||||
"The Observatory",
|
||||
"The Workshop",
|
||||
"The Server Room",
|
||||
"The Garden of Code",
|
||||
"The Portal Room",
|
||||
),
|
||||
)
|
||||
exits = layout.grouped_exits()
|
||||
self.assertEqual(
|
||||
{ex.destination for ex in exits["Great Hall"]},
|
||||
{"Gatehouse", "The Library of Bezalel", "The Observatory", "The Workshop"},
|
||||
)
|
||||
self.assertEqual(
|
||||
{ex.destination for ex in exits["The Workshop"]},
|
||||
{"Great Hall", "The Server Room", "The Garden of Code"},
|
||||
)
|
||||
|
||||
def test_items_characters_and_portal_commands_are_all_defined(self):
|
||||
layout = load_module(LAYOUT_PATH, "bezalel_layout")
|
||||
self.assertEqual(layout.character_keys(), ("Timmy", "Bezalel", "Marcus", "Kimi"))
|
||||
self.assertGreaterEqual(len(layout.OBJECTS), 9)
|
||||
self.assertEqual(layout.portal_command_keys(), ("mac", "vps", "net"))
|
||||
room_names = set(layout.room_keys())
|
||||
for obj in layout.OBJECTS:
|
||||
self.assertIn(obj.location, room_names)
|
||||
for character in layout.CHARACTERS:
|
||||
self.assertIn(character.starting_room, room_names)
|
||||
for portal in layout.PORTAL_COMMANDS:
|
||||
self.assertEqual(portal.fallback_room, "Limbo")
|
||||
|
||||
def test_timmy_can_reach_every_room_from_gatehouse(self):
|
||||
layout = load_module(LAYOUT_PATH, "bezalel_layout")
|
||||
reachable = layout.reachable_rooms_from("Gatehouse")
|
||||
self.assertEqual(reachable, set(layout.room_keys()))
|
||||
|
||||
def test_build_plan_summary_reports_counts_and_portal_aliases(self):
|
||||
build = load_module(BUILD_PATH, "build_bezalel_world")
|
||||
summary = build.describe_build_plan()
|
||||
self.assertEqual(summary["room_count"], 9)
|
||||
self.assertEqual(summary["character_count"], 4)
|
||||
self.assertIn("mac", summary["portal_commands"])
|
||||
self.assertIn("The Workshop", summary["room_names"])
|
||||
self.assertEqual(summary["character_starts"]["Bezalel"], "The Workshop")
|
||||
|
||||
def test_repo_contains_bezalel_world_doc(self):
|
||||
self.assertTrue(DOC_PATH.exists(), "missing committed Bezalel world doc")
|
||||
text = DOC_PATH.read_text(encoding="utf-8")
|
||||
for snippet in (
|
||||
"# Bezalel Evennia World",
|
||||
"## Rooms",
|
||||
"## Characters",
|
||||
"## Portal travel commands",
|
||||
"The Library of Bezalel",
|
||||
"The Garden of Code",
|
||||
):
|
||||
self.assertIn(snippet, text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,737 +0,0 @@
|
||||
"""Auto-generated test suite -- Codebase Genome (#667).
|
||||
|
||||
Generated by scripts/codebase_test_generator.py
|
||||
Coverage gaps identified from AST analysis.
|
||||
|
||||
These tests are starting points. Review before merging.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
|
||||
# AUTO-GENERATED -- DO NOT EDIT WITHOUT REVIEW
|
||||
|
||||
class TestAngbandMcpServerGenerated:
|
||||
"""Auto-generated tests for angband/mcp_server.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:319
|
||||
# Function: call_tool
|
||||
|
||||
@pytest.mark.asyncio
|
||||
def test_angband_mcp_server_call_tool(self):
|
||||
"""Test call_tool -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import call_tool
|
||||
result = call_tool(name='test', arguments=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:64
|
||||
# Function: capture_screen
|
||||
|
||||
def test_angband_mcp_server_capture_screen(self):
|
||||
"""Test capture_screen -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import capture_screen
|
||||
result = capture_screen(lines=None, session_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:74
|
||||
# Function: has_save
|
||||
|
||||
def test_angband_mcp_server_has_save(self):
|
||||
"""Test has_save -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import has_save
|
||||
result = has_save(user=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:234
|
||||
# Function: keypress
|
||||
|
||||
def test_angband_mcp_server_keypress(self):
|
||||
"""Test keypress -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import keypress
|
||||
result = keypress(key='test_id', wait_ms=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:141
|
||||
# Function: launch_game
|
||||
|
||||
def test_angband_mcp_server_launch_game(self):
|
||||
"""Test launch_game -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import launch_game
|
||||
result = launch_game(user=None, new_game=None, continue_splash=None, width='test_id', height=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:253
|
||||
# Function: list_tools
|
||||
|
||||
@pytest.mark.asyncio
|
||||
def test_angband_mcp_server_list_tools(self):
|
||||
"""Test list_tools -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import list_tools
|
||||
result = list_tools()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:130
|
||||
# Function: maybe_continue_splash
|
||||
|
||||
def test_angband_mcp_server_maybe_continue_splash(self):
|
||||
"""Test maybe_continue_splash -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import maybe_continue_splash
|
||||
result = maybe_continue_splash(session_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:226
|
||||
# Function: observe
|
||||
|
||||
def test_angband_mcp_server_observe(self):
|
||||
"""Test observe -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import observe
|
||||
result = observe(lines=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:57
|
||||
# Function: pane_id
|
||||
|
||||
def test_angband_mcp_server_pane_id(self):
|
||||
"""Test pane_id -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import pane_id
|
||||
result = pane_id(session_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:108
|
||||
# Function: send_key
|
||||
|
||||
def test_angband_mcp_server_send_key(self):
|
||||
"""Test send_key -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import send_key
|
||||
with pytest.raises((RuntimeError)):
|
||||
send_key(key='test_id', session_name='test')
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:123
|
||||
# Function: send_text
|
||||
|
||||
def test_angband_mcp_server_send_text(self):
|
||||
"""Test send_text -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import send_text
|
||||
with pytest.raises((RuntimeError)):
|
||||
send_text(text='test msg', session_name='test')
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:53
|
||||
# Function: session_exists
|
||||
|
||||
def test_angband_mcp_server_session_exists(self):
|
||||
"""Test session_exists -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import session_exists
|
||||
result = session_exists(session_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:203
|
||||
# Function: stop_game
|
||||
|
||||
def test_angband_mcp_server_stop_game(self):
|
||||
"""Test stop_game -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import stop_game
|
||||
result = stop_game()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:46
|
||||
# Function: tmux
|
||||
|
||||
def test_angband_mcp_server_tmux(self):
|
||||
"""Test tmux -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import tmux
|
||||
with pytest.raises((RuntimeError)):
|
||||
tmux(args=None, check=None)
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: angband/mcp_server.py:243
|
||||
# Function: type_and_observe
|
||||
|
||||
def test_angband_mcp_server_type_and_observe(self):
|
||||
"""Test type_and_observe -- auto-generated."""
|
||||
try:
|
||||
from angband.mcp_server import type_and_observe
|
||||
result = type_and_observe(text='test msg', wait_ms=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvenniaTimmyWorldGameGenerated:
|
||||
"""Auto-generated tests for evennia/timmy_world/game.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:495
|
||||
# Function: ActionSystem.get_available_actions
|
||||
|
||||
def test_evennia_timmy_world_game_ActionSystem_get_available_actions(self):
|
||||
"""Test ActionSystem.get_available_actions -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import ActionSystem
|
||||
obj = ActionSystem()
|
||||
result = obj.get_available_actions(char_name='test', world=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:1485
|
||||
# Function: PlayerInterface.get_available_actions
|
||||
|
||||
def test_evennia_timmy_world_game_PlayerInterface_get_available_actions(self):
|
||||
"""Test PlayerInterface.get_available_actions -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import PlayerInterface
|
||||
obj = PlayerInterface()
|
||||
result = obj.get_available_actions()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:55
|
||||
# Function: get_narrative_phase
|
||||
|
||||
def test_evennia_timmy_world_game_get_narrative_phase(self):
|
||||
"""Test get_narrative_phase -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import get_narrative_phase
|
||||
result = get_narrative_phase(tick=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:65
|
||||
# Function: get_phase_transition_event
|
||||
|
||||
def test_evennia_timmy_world_game_get_phase_transition_event(self):
|
||||
"""Test get_phase_transition_event -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import get_phase_transition_event
|
||||
result = get_phase_transition_event(old_phase=None, new_phase=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:347
|
||||
# Function: World.get_room_desc
|
||||
|
||||
def test_evennia_timmy_world_game_World_get_room_desc(self):
|
||||
"""Test World.get_room_desc -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import World
|
||||
obj = World()
|
||||
result = obj.get_room_desc(room_name='test', char_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:1045
|
||||
# Function: GameEngine.load_game
|
||||
|
||||
def test_evennia_timmy_world_game_GameEngine_load_game(self):
|
||||
"""Test GameEngine.load_game -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import GameEngine
|
||||
obj = GameEngine()
|
||||
result = obj.load_game()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:556
|
||||
# Function: NPCAI.make_choice
|
||||
|
||||
def test_evennia_timmy_world_game_NPCAI_make_choice(self):
|
||||
"""Test NPCAI.make_choice -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import NPCAI
|
||||
obj = NPCAI()
|
||||
result = obj.make_choice(char_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:1454
|
||||
# Function: GameEngine.play_turn
|
||||
|
||||
def test_evennia_timmy_world_game_GameEngine_play_turn(self):
|
||||
"""Test GameEngine.play_turn -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import GameEngine
|
||||
obj = GameEngine()
|
||||
result = obj.play_turn(action=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/game.py:1076
|
||||
# Function: GameEngine.run_tick
|
||||
|
||||
def test_evennia_timmy_world_game_GameEngine_run_tick(self):
|
||||
"""Test GameEngine.run_tick -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.game import GameEngine
|
||||
obj = GameEngine()
|
||||
result = obj.run_tick(timmy_action=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvenniaTimmyWorldServerConfWebPluginsGenerated:
|
||||
"""Auto-generated tests for evennia/timmy_world/server/conf/web_plugins.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/server/conf/web_plugins.py:31
|
||||
# Function: at_webproxy_root_creation
|
||||
|
||||
def test_evennia_timmy_world_server_conf_web_plugins_at_webproxy_root_creation(self):
|
||||
"""Test at_webproxy_root_creation -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.server.conf.web_plugins import at_webproxy_root_creation
|
||||
result = at_webproxy_root_creation(web_root=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/server/conf/web_plugins.py:6
|
||||
# Function: at_webserver_root_creation
|
||||
|
||||
def test_evennia_timmy_world_server_conf_web_plugins_at_webserver_root_creation(self):
|
||||
"""Test at_webserver_root_creation -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.server.conf.web_plugins import at_webserver_root_creation
|
||||
result = at_webserver_root_creation(web_root=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvenniaTimmyWorldWorldGameGenerated:
|
||||
"""Auto-generated tests for evennia/timmy_world/world/game.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:400
|
||||
# Function: ActionSystem.get_available_actions
|
||||
|
||||
def test_evennia_timmy_world_world_game_ActionSystem_get_available_actions(self):
|
||||
"""Test ActionSystem.get_available_actions -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import ActionSystem
|
||||
obj = ActionSystem()
|
||||
result = obj.get_available_actions(char_name='test', world=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:1289
|
||||
# Function: PlayerInterface.get_available_actions
|
||||
|
||||
def test_evennia_timmy_world_world_game_PlayerInterface_get_available_actions(self):
|
||||
"""Test PlayerInterface.get_available_actions -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import PlayerInterface
|
||||
obj = PlayerInterface()
|
||||
result = obj.get_available_actions()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:254
|
||||
# Function: World.get_room_desc
|
||||
|
||||
def test_evennia_timmy_world_world_game_World_get_room_desc(self):
|
||||
"""Test World.get_room_desc -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import World
|
||||
obj = World()
|
||||
result = obj.get_room_desc(room_name='test', char_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:880
|
||||
# Function: GameEngine.load_game
|
||||
|
||||
def test_evennia_timmy_world_world_game_GameEngine_load_game(self):
|
||||
"""Test GameEngine.load_game -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import GameEngine
|
||||
obj = GameEngine()
|
||||
result = obj.load_game()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:461
|
||||
# Function: NPCAI.make_choice
|
||||
|
||||
def test_evennia_timmy_world_world_game_NPCAI_make_choice(self):
|
||||
"""Test NPCAI.make_choice -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import NPCAI
|
||||
obj = NPCAI()
|
||||
result = obj.make_choice(char_name='test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:1258
|
||||
# Function: GameEngine.play_turn
|
||||
|
||||
def test_evennia_timmy_world_world_game_GameEngine_play_turn(self):
|
||||
"""Test GameEngine.play_turn -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import GameEngine
|
||||
obj = GameEngine()
|
||||
result = obj.play_turn(action=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:911
|
||||
# Function: GameEngine.run_tick
|
||||
|
||||
def test_evennia_timmy_world_world_game_GameEngine_run_tick(self):
|
||||
"""Test GameEngine.run_tick -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import GameEngine
|
||||
obj = GameEngine()
|
||||
result = obj.run_tick(timmy_action=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia/timmy_world/world/game.py:749
|
||||
# Function: DialogueSystem.select
|
||||
|
||||
def test_evennia_timmy_world_world_game_DialogueSystem_select(self):
|
||||
"""Test DialogueSystem.select -- auto-generated."""
|
||||
try:
|
||||
from evennia.timmy_world.world.game import DialogueSystem
|
||||
obj = DialogueSystem()
|
||||
result = obj.select(char_name='test', listener=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvenniaToolsLayoutGenerated:
|
||||
"""Auto-generated tests for evennia_tools/layout.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia_tools/layout.py:58
|
||||
# Function: grouped_exits
|
||||
|
||||
def test_evennia_tools_layout_grouped_exits(self):
|
||||
"""Test grouped_exits -- auto-generated."""
|
||||
try:
|
||||
from evennia_tools.layout import grouped_exits
|
||||
result = grouped_exits()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia_tools/layout.py:54
|
||||
# Function: room_keys
|
||||
|
||||
def test_evennia_tools_layout_room_keys(self):
|
||||
"""Test room_keys -- auto-generated."""
|
||||
try:
|
||||
from evennia_tools.layout import room_keys
|
||||
result = room_keys()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvenniaToolsTelemetryGenerated:
|
||||
"""Auto-generated tests for evennia_tools/telemetry.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia_tools/telemetry.py:8
|
||||
# Function: telemetry_dir
|
||||
|
||||
def test_evennia_tools_telemetry_telemetry_dir(self):
|
||||
"""Test telemetry_dir -- auto-generated."""
|
||||
try:
|
||||
from evennia_tools.telemetry import telemetry_dir
|
||||
result = telemetry_dir(base_dir='/tmp/test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvenniaToolsTrainingGenerated:
|
||||
"""Auto-generated tests for evennia_tools/training.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia_tools/training.py:18
|
||||
# Function: example_eval_path
|
||||
|
||||
def test_evennia_tools_training_example_eval_path(self):
|
||||
"""Test example_eval_path -- auto-generated."""
|
||||
try:
|
||||
from evennia_tools.training import example_eval_path
|
||||
result = example_eval_path(repo_root=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evennia_tools/training.py:14
|
||||
# Function: example_trace_path
|
||||
|
||||
def test_evennia_tools_training_example_trace_path(self):
|
||||
"""Test example_trace_path -- auto-generated."""
|
||||
try:
|
||||
from evennia_tools.training import example_trace_path
|
||||
result = example_trace_path(repo_root=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvolutionBitcoinScripterGenerated:
|
||||
"""Auto-generated tests for evolution/bitcoin_scripter.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evolution/bitcoin_scripter.py:18
|
||||
# Function: BitcoinScripter.generate_script
|
||||
|
||||
def test_evolution_bitcoin_scripter_BitcoinScripter_generate_script(self):
|
||||
"""Test BitcoinScripter.generate_script -- auto-generated."""
|
||||
try:
|
||||
from evolution.bitcoin_scripter import BitcoinScripter
|
||||
obj = BitcoinScripter()
|
||||
result = obj.generate_script(requirements=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvolutionLightningClientGenerated:
|
||||
"""Auto-generated tests for evolution/lightning_client.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evolution/lightning_client.py:18
|
||||
# Function: LightningClient.plan_payment_route
|
||||
|
||||
def test_evolution_lightning_client_LightningClient_plan_payment_route(self):
|
||||
"""Test LightningClient.plan_payment_route -- auto-generated."""
|
||||
try:
|
||||
from evolution.lightning_client import LightningClient
|
||||
obj = LightningClient()
|
||||
result = obj.plan_payment_route(destination=None, amount_sats=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestEvolutionSovereignAccountantGenerated:
|
||||
"""Auto-generated tests for evolution/sovereign_accountant.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: evolution/sovereign_accountant.py:17
|
||||
# Function: SovereignAccountant.generate_financial_report
|
||||
|
||||
def test_evolution_sovereign_accountant_SovereignAccountant_generate_financial_report(self):
|
||||
"""Test SovereignAccountant.generate_financial_report -- auto-generated."""
|
||||
try:
|
||||
from evolution.sovereign_accountant import SovereignAccountant
|
||||
obj = SovereignAccountant()
|
||||
result = obj.generate_financial_report(transaction_history=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestInfrastructureTimmyBridgeClientTimmyClientGenerated:
|
||||
"""Auto-generated tests for infrastructure/timmy-bridge/client/timmy_client.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/client/timmy_client.py:108
|
||||
# Function: TimmyClient.create_artifact
|
||||
|
||||
def test_infrastructure_timmy_bridge_client_timmy_client_TimmyClient_create_artifact(self):
|
||||
"""Test TimmyClient.create_artifact -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.client.timmy_client import TimmyClient
|
||||
obj = TimmyClient()
|
||||
result = obj.create_artifact()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/client/timmy_client.py:167
|
||||
# Function: TimmyClient.create_event
|
||||
|
||||
def test_infrastructure_timmy_bridge_client_timmy_client_TimmyClient_create_event(self):
|
||||
"""Test TimmyClient.create_event -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.client.timmy_client import TimmyClient
|
||||
obj = TimmyClient()
|
||||
result = obj.create_event(kind=None, content=None, tags=None)
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/client/timmy_client.py:74
|
||||
# Function: TimmyClient.generate_observation
|
||||
|
||||
def test_infrastructure_timmy_bridge_client_timmy_client_TimmyClient_generate_observation(self):
|
||||
"""Test TimmyClient.generate_observation -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.client.timmy_client import TimmyClient
|
||||
obj = TimmyClient()
|
||||
result = obj.generate_observation()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
|
||||
class TestInfrastructureTimmyBridgeMlxMlxIntegrationGenerated:
|
||||
"""Auto-generated tests for infrastructure/timmy-bridge/mlx/mlx_integration.py."""
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/mlx/mlx_integration.py:122
|
||||
# Function: MLXInference.available
|
||||
|
||||
def test_infrastructure_timmy_bridge_mlx_mlx_integration_MLXInference_available(self):
|
||||
"""Test MLXInference.available -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.mlx.mlx_integration import MLXInference
|
||||
obj = MLXInference()
|
||||
_ = obj.available
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/mlx/mlx_integration.py:125
|
||||
# Function: MLXInference.get_stats
|
||||
|
||||
def test_infrastructure_timmy_bridge_mlx_mlx_integration_MLXInference_get_stats(self):
|
||||
"""Test MLXInference.get_stats -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.mlx.mlx_integration import MLXInference
|
||||
obj = MLXInference()
|
||||
result = obj.get_stats()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/mlx/mlx_integration.py:30
|
||||
# Function: MLXInference.load_model
|
||||
|
||||
def test_infrastructure_timmy_bridge_mlx_mlx_integration_MLXInference_load_model(self):
|
||||
"""Test MLXInference.load_model -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.mlx.mlx_integration import MLXInference
|
||||
obj = MLXInference()
|
||||
result = obj.load_model(model_path='/tmp/test')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/mlx/mlx_integration.py:93
|
||||
# Function: MLXInference.reflect
|
||||
|
||||
def test_infrastructure_timmy_bridge_mlx_mlx_integration_MLXInference_reflect(self):
|
||||
"""Test MLXInference.reflect -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.mlx.mlx_integration import MLXInference
|
||||
obj = MLXInference()
|
||||
result = obj.reflect()
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
|
||||
# AUTO-GENERATED -- review before merging
|
||||
# Source: infrastructure/timmy-bridge/mlx/mlx_integration.py:108
|
||||
# Function: MLXInference.respond_to
|
||||
|
||||
def test_infrastructure_timmy_bridge_mlx_mlx_integration_MLXInference_respond_to(self):
|
||||
"""Test MLXInference.respond_to -- auto-generated."""
|
||||
try:
|
||||
from infrastructure.timmy_bridge.mlx.mlx_integration import MLXInference
|
||||
obj = MLXInference()
|
||||
result = obj.respond_to(message='test msg', context='test msg')
|
||||
assert result is not None or result is None # Placeholder
|
||||
except ImportError:
|
||||
pytest.skip('Module not importable')
|
||||
Reference in New Issue
Block a user