import tempfile from pathlib import Path import pytest from diceplayer.config import PlayerConfig, DiceConfig, GaussianConfig from diceplayer.state.state_handler import StateHandler class TestStateHandler: @pytest.fixture def player_config(self) -> PlayerConfig: return PlayerConfig( opt=True, mem=12, maxcyc=100, nprocs=4, ncores=4, dice=DiceConfig( ljname="test", outname="test", dens=1.0, nmol=[1], nstep=[1, 1], ), gaussian=GaussianConfig( level="test", qmprog="g16", keywords="test", ), ) def test_state_handler_initialization(self): with tempfile.TemporaryDirectory() as tmpdir: tmpdir_path = Path(tmpdir) state_handler = StateHandler(tmpdir_path) assert isinstance(state_handler, StateHandler) def test_state_handler_get_state(self, player_config: PlayerConfig): with tempfile.TemporaryDirectory() as tmpdir: tmpdir_path = Path(tmpdir) state_handler = StateHandler(tmpdir_path) state = state_handler.get_state(player_config) assert state is None