diff --git a/diceplayer/shared/interface/dice_interface.py b/diceplayer/shared/interface/dice_interface.py index 90630e8..91b091e 100644 --- a/diceplayer/shared/interface/dice_interface.py +++ b/diceplayer/shared/interface/dice_interface.py @@ -15,6 +15,7 @@ import time import sys import os + DICE_END_FLAG: Final[str] = "End of simulation" DICE_FLAG_LINE: Final[int] = -2 UMAANG3_TO_GCM3: Final[float] = 1.6605 diff --git a/tests/shared/config/test_player_dto.py b/tests/shared/config/test_player_dto.py index a514fb1..98440af 100644 --- a/tests/shared/config/test_player_dto.py +++ b/tests/shared/config/test_player_dto.py @@ -5,12 +5,12 @@ import unittest class TestPlayerDTO(unittest.TestCase): def test_class_instantiation(self): - player_dto = PlayerDTO(opt=True, maxcyc=100, nprocs=4) + player_dto = PlayerDTO(opt=True, maxcyc=100, nprocs=4, ncores=4) self.assertIsInstance(player_dto, PlayerDTO) def test_min_altsteps(self): - player_dto = PlayerDTO(opt=True, maxcyc=100, nprocs=4, altsteps=100) + player_dto = PlayerDTO(opt=True, maxcyc=100, nprocs=4, ncores=4, altsteps=100) self.assertEqual(player_dto.altsteps, 20000) @@ -18,7 +18,8 @@ class TestPlayerDTO(unittest.TestCase): player_dto = PlayerDTO.from_dict({ 'opt': True, 'maxcyc': 100, - 'nprocs': 4 + 'nprocs': 4, + 'ncores': 4, }) self.assertIsInstance(player_dto, PlayerDTO) diff --git a/tests/shared/interface/test_dice_interface.py b/tests/shared/interface/test_dice_interface.py index 4698751..1f2c6c4 100644 --- a/tests/shared/interface/test_dice_interface.py +++ b/tests/shared/interface/test_dice_interface.py @@ -1,6 +1,9 @@ from diceplayer.shared.interface.dice_interface import DiceInterface +from diceplayer.shared.environment.molecule import Molecule from diceplayer.shared.config.step_dto import StepDTO +import io + from tests.mocks.mock_proc import MockConnection, MockProc from unittest import mock @@ -560,6 +563,38 @@ class TestDiceInterface(unittest.TestCase): with self.assertRaises(FileNotFoundError): dice._run_dice(1, 1) + def test_make_init_file(self): + dice = DiceInterface( + { + 'ljname': 'test', + 'outname': 'test', + 'ncores': 1, + 'dens': 1.0, + 'nmol': [1], + 'nstep': [1, 1], + } + ) + dice.configure( + StepDTO( + ncores=1, + nprocs=1, + simulation_dir='test', + altsteps=1, + molecule=[ + + ], + nmol=[], + ) + ) + + last_xyz_file = io.StringIO() + last_xyz_file.writelines([ + 'TEST', + 'TEST', + 'TEST', + 'TEST', + ]) + if __name__ == '__main__': unittest.main()