68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
from diceplayer.config import PlayerConfig
|
|
from diceplayer.dice.dice_input import (
|
|
NPTEqConfig,
|
|
NPTTerConfig,
|
|
NVTEqConfig,
|
|
NVTTerConfig,
|
|
write_config,
|
|
)
|
|
|
|
import pytest
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
class TestDiceInput:
|
|
@pytest.fixture
|
|
def player_config(self) -> PlayerConfig:
|
|
return PlayerConfig.model_validate(
|
|
{
|
|
"type": "both",
|
|
"mem": 12,
|
|
"max_cyc": 100,
|
|
"switch_cyc": 50,
|
|
"ncores": 4,
|
|
"dice": {
|
|
"nprocs": 4,
|
|
"ljname": "test",
|
|
"outname": "test",
|
|
"dens": 1.0,
|
|
"nmol": [1],
|
|
"nstep": [1, 1],
|
|
},
|
|
"gaussian": {
|
|
"level": "test",
|
|
"qmprog": "g16",
|
|
"keywords": "test",
|
|
},
|
|
}
|
|
)
|
|
|
|
def test_generate_nvt_ter_input(self, player_config: PlayerConfig):
|
|
dice_input = NVTTerConfig.from_config(player_config)
|
|
|
|
assert isinstance(dice_input, NVTTerConfig)
|
|
|
|
def test_generate_nvt_eq_input(self, player_config: PlayerConfig):
|
|
dice_input = NVTEqConfig.from_config(player_config)
|
|
|
|
assert isinstance(dice_input, NVTEqConfig)
|
|
|
|
def test_generate_npt_ter_input(self, player_config: PlayerConfig):
|
|
dice_input = NPTTerConfig.from_config(player_config)
|
|
|
|
assert isinstance(dice_input, NPTTerConfig)
|
|
|
|
def test_generate_npt_eq_input(self, player_config: PlayerConfig):
|
|
dice_input = NPTEqConfig.from_config(player_config)
|
|
|
|
assert isinstance(dice_input, NPTEqConfig)
|
|
|
|
def test_write_dice_config(self, player_config: PlayerConfig, tmp_path: Path):
|
|
dice_input = NVTTerConfig.from_config(player_config)
|
|
|
|
output_file = tmp_path / dice_input.type
|
|
write_config(dice_input, tmp_path)
|
|
|
|
assert output_file.exists()
|