feat: improves and initilize player pipeline
This commit is contained in:
30
tests/cli/test_read_input_file.py
Normal file
30
tests/cli/test_read_input_file.py
Normal 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)
|
||||
Reference in New Issue
Block a user