49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
import sys
|
|
from pathlib import Path
|
|
|
|
# Добавляем путь к scripts и faction_turns
|
|
scripts_path = Path(__file__).resolve().parent.parent.parent
|
|
faction_turns_path = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(scripts_path))
|
|
sys.path.insert(0, str(faction_turns_path))
|
|
|
|
from resolve_faction_turn import _resolve_repair_asset
|
|
|
|
def test_repair_boi_powerful():
|
|
print("--- Тест Repair Asset для мощной фракции ---")
|
|
|
|
faction_fm = {
|
|
"name": "Powerful Faction",
|
|
"treasure": 10,
|
|
"force": 6,
|
|
"assets": [
|
|
{
|
|
"name": "Base of Influence — [[Лускан]]",
|
|
"is_base_of_influence": True,
|
|
"hp": 5,
|
|
"hp_max": 20,
|
|
"location": "[[Лускан]]"
|
|
}
|
|
]
|
|
}
|
|
|
|
action = {
|
|
"faction_file": "Powerful_Faction",
|
|
"action_type": "Repair Asset",
|
|
"location": "[[Лускан]]",
|
|
"repair_asset": "Base of Influence"
|
|
}
|
|
|
|
result = _resolve_repair_asset(action, faction_fm, 1)
|
|
|
|
print(f"Результат: {result}")
|
|
assert "error" not in result, f"Ошибка: {result.get('error')}"
|
|
|
|
assert result["healed"] == 3, f"Ожидали лечение на 3 (ceil(Force 6 / 2)), получили {result['healed']}"
|
|
assert result["hp_after"] == 8, f"Ожидали HP 8, получили {result['hp_after']}"
|
|
|
|
print("\nТест мощной фракции успешно пройден!")
|
|
|
|
if __name__ == "__main__":
|
|
test_repair_boi_powerful()
|