"""补生成参数：_assign_slots seq_offset 续编 + run_pipeline_v2 默认签名兼容。"""

import inspect

from app.question_gen.pipeline_v2 import _assign_slots, run_pipeline_v2


def test_assign_slots_seq_offset_continues_numbering():
    slots = _assign_slots(["v1"], ["Action Recognition"], 2, seq_offset=10)
    assert [s.seq for s in slots] == [11, 12]
    assert slots[0].slot_id == "Action Recognition_0011"


def test_assign_slots_default_offset_unchanged():
    slots = _assign_slots(["v1"], ["Action Recognition"], 2)
    assert [s.seq for s in slots] == [1, 2]
    assert slots[0].slot_id == "Action Recognition_0001"


def test_run_pipeline_v2_new_optional_params_default_none():
    sig = inspect.signature(run_pipeline_v2)
    for name in ("initial_used_node_ids", "initial_embed_pool", "seq_offset"):
        assert name in sig.parameters, name
        assert sig.parameters[name].kind == inspect.Parameter.KEYWORD_ONLY
    assert sig.parameters["initial_used_node_ids"].default is None
    assert sig.parameters["initial_embed_pool"].default is None
    assert sig.parameters["seq_offset"].default == 0
