new RPG system
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
from services.rpg_plot import choices_from_beat, choices_from_narrator, normalize_choice
|
||||
from services.rpg_plot import (
|
||||
choices_from_beat,
|
||||
choices_from_narrator,
|
||||
normalize_choice,
|
||||
format_beat_injection_for_character,
|
||||
)
|
||||
|
||||
|
||||
def test_choices_from_beat_tags_source():
|
||||
@@ -13,7 +18,7 @@ def test_choices_from_beat_tags_source():
|
||||
}
|
||||
out = choices_from_beat(beat)
|
||||
assert len(out) == 2
|
||||
assert out[0]["source"] == "plot_beat"
|
||||
assert out[0]["source"] == "plot_step"
|
||||
assert out[0]["beat_title"] == "Rest Stop Confession"
|
||||
assert out[0]["beat_id"] == "b_new_1"
|
||||
assert "beat_injection" in out[0]
|
||||
@@ -25,5 +30,24 @@ def test_choices_from_narrator_tags_source():
|
||||
assert "beat_title" not in out[0]
|
||||
|
||||
|
||||
def test_beat_injection_block_for_character_prompt():
|
||||
block = format_beat_injection_for_character(
|
||||
"Over pancakes, Luna steals glances at you.",
|
||||
lang="en",
|
||||
)
|
||||
assert "Plot hint" in block
|
||||
assert "Over pancakes" in block
|
||||
assert format_beat_injection_for_character("") == ""
|
||||
|
||||
|
||||
def test_beat_injection_block_ru():
|
||||
block = format_beat_injection_for_character(
|
||||
"Луна крадёт взгляды через блины.",
|
||||
lang="ru",
|
||||
)
|
||||
assert "Сюжетная подсказка" in block
|
||||
assert "по-русски" in block
|
||||
|
||||
|
||||
def test_normalize_choice_skips_empty_label():
|
||||
assert normalize_choice({"id": "a", "label": " "}, source="narrator") is None
|
||||
|
||||
Reference in New Issue
Block a user