moss4gb / tests /test_cli.py
AEUPH's picture
moss4gb v0.2.0: NF4 4-bit MOSS-Image-SFT packaging (code, bank, tests, docs, skill)
1533f24 verified
Raw History Blame Contribute Delete
1.23 kB
from __future__ import annotations
import pytest
from moss4gb.cli import _parse_skip, build_parser
def test_parse_skip():
assert _parse_skip("22") == (22,)
assert _parse_skip("22,24,26") == (22, 24, 26)
assert _parse_skip("") == ()
assert _parse_skip("none") == ()
assert _parse_skip("off") == ()
def test_generate_defaults():
args = build_parser().parse_args(["generate"])
assert (args.height, args.width) == (512, 512)
assert args.steps == 20
assert args.cfg == 3.0
assert args.compute_dtype == "float16"
assert args.vae_device == "cpu"
from pathlib import Path
assert Path(args.bank) == Path("assets/bank")
def test_bank_build_requires_a_prompt():
args = build_parser().parse_args(["bank", "build", "--dry-run", "--prompt", "x"])
assert args.bank_action == "build" and args.dry_run and args.prompt == ["x"]
def test_subcommand_is_required():
with pytest.raises(SystemExit):
build_parser().parse_args([])
def test_generate_cache_flags():
args = build_parser().parse_args(["generate"])
assert args.cache is None and args.no_cache is False
args = build_parser().parse_args(["generate", "--no-cache"])
assert args.no_cache is True