train_utility/tests/test_app.py
srvoyo-cell 1dcc6a5249 init
2026-07-16 14:37:12 +04:00

52 lines
1.9 KiB
Python

from __future__ import annotations
import asyncio
from textual.widgets import Button, Input, Select, Switch
from yolo_tui.app import YoloTrainApp
def test_app_mounts_with_expected_defaults() -> None:
async def exercise() -> None:
app = YoloTrainApp()
async with app.run_test(size=(140, 45)):
assert app.query_one("#task", Select).value == "detect"
assert app.query_one("#model", Input).value == "yolo11n.pt"
assert app.query_one("#dataset", Input).value == "coco8.yaml"
assert app.query_one("#augmentation-enabled", Switch).value is True
assert app.query_one("#mosaic", Input).value == "1.0"
assert app.query_one("#auto-augment", Select).value == "randaugment"
assert app.query_one("#mlflow-enabled", Switch).value is True
assert app.query_one("#start-button", Button).disabled is False
assert app.query_one("#stop-button", Button).disabled is True
asyncio.run(exercise())
def test_augmentation_fields_follow_switch() -> None:
async def exercise() -> None:
app = YoloTrainApp()
async with app.run_test(size=(140, 45)) as pilot:
switch = app.query_one("#augmentation-enabled", Switch)
switch.value = False
await pilot.pause()
assert app.query_one("#mosaic", Input).disabled is True
assert app.query_one("#auto-augment", Select).disabled is True
asyncio.run(exercise())
def test_mlflow_fields_follow_switch() -> None:
async def exercise() -> None:
app = YoloTrainApp()
async with app.run_test(size=(140, 45)) as pilot:
switch = app.query_one("#mlflow-enabled", Switch)
switch.value = False
await pilot.pause()
assert app.query_one("#tracking-uri", Input).disabled is True
assert app.query_one("#experiment-name", Input).disabled is True
asyncio.run(exercise())