Finishes DiceInterface Refactoring and Continues Tests Implementation
This commit is contained in:
@@ -8,10 +8,9 @@ class TestDiceDto(unittest.TestCase):
|
||||
dice_dto = DiceDTO(
|
||||
ljname='test',
|
||||
outname='test',
|
||||
ncores=1,
|
||||
dens=1.0,
|
||||
nmol=[1],
|
||||
nstep=[1],
|
||||
nstep=[1, 1],
|
||||
)
|
||||
|
||||
self.assertIsInstance(dice_dto, DiceDTO)
|
||||
@@ -21,10 +20,9 @@ class TestDiceDto(unittest.TestCase):
|
||||
DiceDTO(
|
||||
ljname=None,
|
||||
outname='test',
|
||||
ncores=1,
|
||||
dens=1.0,
|
||||
nmol=[1],
|
||||
nstep=[1],
|
||||
nstep=[1, 1],
|
||||
)
|
||||
self.assertEqual(ex.exception, "Error: 'ljname' keyword not specified in config file")
|
||||
|
||||
@@ -33,10 +31,9 @@ class TestDiceDto(unittest.TestCase):
|
||||
DiceDTO(
|
||||
ljname='test',
|
||||
outname=None,
|
||||
ncores=1,
|
||||
dens=1.0,
|
||||
nmol=[1],
|
||||
nstep=[1],
|
||||
nstep=[1, 1],
|
||||
)
|
||||
self.assertEqual(ex.exception, "Error: 'outname' keyword not specified in config file")
|
||||
|
||||
@@ -45,10 +42,9 @@ class TestDiceDto(unittest.TestCase):
|
||||
DiceDTO(
|
||||
ljname='test',
|
||||
outname='test',
|
||||
ncores=1,
|
||||
dens=None,
|
||||
nmol=[1],
|
||||
nstep=[1],
|
||||
nstep=[1, 1],
|
||||
)
|
||||
self.assertEqual(ex.exception, "Error: 'dens' keyword not specified in config file")
|
||||
|
||||
@@ -57,10 +53,9 @@ class TestDiceDto(unittest.TestCase):
|
||||
DiceDTO(
|
||||
ljname='test',
|
||||
outname='test',
|
||||
ncores=1,
|
||||
dens=1.0,
|
||||
nmol=0,
|
||||
nstep=[1],
|
||||
nstep=[1, 1],
|
||||
)
|
||||
self.assertEqual(ex.exception, "Error: 'nmol' keyword not defined appropriately in config file")
|
||||
|
||||
@@ -69,7 +64,6 @@ class TestDiceDto(unittest.TestCase):
|
||||
DiceDTO(
|
||||
ljname='test',
|
||||
outname='test',
|
||||
ncores=1,
|
||||
dens=1.0,
|
||||
nmol=[1],
|
||||
nstep=0,
|
||||
@@ -80,10 +74,9 @@ class TestDiceDto(unittest.TestCase):
|
||||
dice_dto = DiceDTO.from_dict({
|
||||
'ljname': 'test',
|
||||
'outname': 'test',
|
||||
'ncores': 1,
|
||||
'dens': 1.0,
|
||||
'nmol': [1],
|
||||
'nstep': [1],
|
||||
'nstep': [1, 1],
|
||||
})
|
||||
|
||||
self.assertIsInstance(dice_dto, DiceDTO)
|
||||
45
tests/shared/config/test_gaussian_dto.py
Normal file
45
tests/shared/config/test_gaussian_dto.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from diceplayer.shared.config.gaussian_dto import GaussianDTO
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class TestGaussianDTO(unittest.TestCase):
|
||||
def test_class_instantiation(self):
|
||||
gaussian_dto = GaussianDTO(
|
||||
level='test',
|
||||
qmprog='g16',
|
||||
keywords='test',
|
||||
)
|
||||
|
||||
self.assertIsInstance(gaussian_dto, GaussianDTO)
|
||||
|
||||
def test_is_valid_qmprog(self):
|
||||
with self.assertRaises(ValueError):
|
||||
gaussian_dto = GaussianDTO(
|
||||
level='test',
|
||||
qmprog='test',
|
||||
keywords='test',
|
||||
)
|
||||
|
||||
def test_is_valid_level(self):
|
||||
with self.assertRaises(ValueError):
|
||||
gaussian_dto = GaussianDTO(
|
||||
level=None,
|
||||
qmprog='g16',
|
||||
keywords='test',
|
||||
)
|
||||
|
||||
def test_from_dict(self):
|
||||
gaussian_dto = GaussianDTO.from_dict(
|
||||
{
|
||||
'level': 'test',
|
||||
'qmprog': 'g16',
|
||||
'keywords': 'test',
|
||||
}
|
||||
)
|
||||
|
||||
self.assertIsInstance(gaussian_dto, GaussianDTO)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
28
tests/shared/config/test_player_dto.py
Normal file
28
tests/shared/config/test_player_dto.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from diceplayer.shared.config.player_dto import PlayerDTO
|
||||
|
||||
import unittest
|
||||
|
||||
|
||||
class TestPlayerDTO(unittest.TestCase):
|
||||
def test_class_instantiation(self):
|
||||
player_dto = PlayerDTO(opt=True, maxcyc=100, nprocs=4)
|
||||
|
||||
self.assertIsInstance(player_dto, PlayerDTO)
|
||||
|
||||
def test_min_altsteps(self):
|
||||
player_dto = PlayerDTO(opt=True, maxcyc=100, nprocs=4, altsteps=100)
|
||||
|
||||
self.assertEqual(player_dto.altsteps, 20000)
|
||||
|
||||
def test_from_dict(self):
|
||||
player_dto = PlayerDTO.from_dict({
|
||||
'opt': True,
|
||||
'maxcyc': 100,
|
||||
'nprocs': 4
|
||||
})
|
||||
|
||||
self.assertIsInstance(player_dto, PlayerDTO)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user