feat: improves and initilize player pipeline

This commit is contained in:
2026-03-05 00:33:48 -03:00
parent 06ae9b41f0
commit 53eb34a83e
13 changed files with 248 additions and 60 deletions

View File

@@ -0,0 +1,30 @@
import diceplayer
from diceplayer.cli import read_input
from diceplayer.config import PlayerConfig
import pytest
from pathlib import Path
class TestReadInputFile:
@pytest.fixture
def example_config(self) -> Path:
return Path(diceplayer.__path__[0]).parent / "control.example.yml"
def test_read_input_file(self, example_config: Path):
config = read_input(example_config)
assert config is not None
assert isinstance(config, PlayerConfig)
def test_read_input_non_existing_file(self):
with pytest.raises(FileNotFoundError):
read_input("nonexistent_file.yml")
def test_read_input_invalid_yaml(self, tmp_path: Path):
invalid_yaml_file = tmp_path / "invalid.yml"
invalid_yaml_file.write_text("This is not valid YAML: [unbalanced brackets")
with pytest.raises(Exception):
read_input(invalid_yaml_file)