Adds Formatter to Project
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
from diceplayer.shared.interface.gaussian_interface import GaussianInterface
|
||||
from diceplayer import logger
|
||||
from diceplayer.shared.config.player_config import PlayerConfig
|
||||
from diceplayer.shared.environment.system import System
|
||||
from diceplayer import logger
|
||||
|
||||
from diceplayer.shared.interface.gaussian_interface import GaussianInterface
|
||||
from tests.mocks.mock_inputs import get_config_example
|
||||
|
||||
import yaml
|
||||
|
||||
import io
|
||||
|
||||
|
||||
from unittest import mock
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
|
||||
class TestGaussianInterface(unittest.TestCase):
|
||||
@@ -18,7 +16,7 @@ class TestGaussianInterface(unittest.TestCase):
|
||||
logger.set_logger(stream=io.StringIO())
|
||||
|
||||
config = yaml.load(get_config_example(), Loader=yaml.Loader)
|
||||
self.config = PlayerConfig.from_dict(config['diceplayer'])
|
||||
self.config = PlayerConfig.from_dict(config["diceplayer"])
|
||||
|
||||
def test_class_instantiation(self):
|
||||
gaussian_interface = GaussianInterface()
|
||||
@@ -45,11 +43,11 @@ class TestGaussianInterface(unittest.TestCase):
|
||||
|
||||
gaussian_interface.reset()
|
||||
|
||||
self.assertFalse(hasattr(gaussian_interface, 'step'))
|
||||
self.assertFalse(hasattr(gaussian_interface, 'system'))
|
||||
self.assertFalse(hasattr(gaussian_interface, "step"))
|
||||
self.assertFalse(hasattr(gaussian_interface, "system"))
|
||||
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.Path.mkdir')
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.Path.exists')
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.Path.mkdir")
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.Path.exists")
|
||||
def test_make_qm_dir(self, mock_exists, mock_mkdir):
|
||||
mock_exists.return_value = False
|
||||
|
||||
@@ -61,8 +59,8 @@ class TestGaussianInterface(unittest.TestCase):
|
||||
mock_exists.assert_called_once()
|
||||
mock_mkdir.assert_called_once()
|
||||
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.shutil.copy')
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.Path.exists')
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.shutil.copy")
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.Path.exists")
|
||||
def test_copy_chk_file_from_previous_step(self, mock_exists, mock_copy):
|
||||
gaussian_interface = GaussianInterface()
|
||||
gaussian_interface.configure(self.config, System())
|
||||
@@ -74,9 +72,11 @@ class TestGaussianInterface(unittest.TestCase):
|
||||
self.assertTrue(mock_exists.called)
|
||||
self.assertTrue(mock_copy.called)
|
||||
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.shutil.copy')
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.Path.exists')
|
||||
def test_copy_chk_file_from_previous_step_no_previous_step(self, mock_exists, mock_copy):
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.shutil.copy")
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.Path.exists")
|
||||
def test_copy_chk_file_from_previous_step_no_previous_step(
|
||||
self, mock_exists, mock_copy
|
||||
):
|
||||
gaussian_interface = GaussianInterface()
|
||||
gaussian_interface.configure(self.config, System())
|
||||
|
||||
@@ -85,9 +85,11 @@ class TestGaussianInterface(unittest.TestCase):
|
||||
with self.assertRaises(FileNotFoundError):
|
||||
gaussian_interface._copy_chk_file_from_previous_step(2)
|
||||
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.shutil.copy')
|
||||
@mock.patch('diceplayer.shared.interface.gaussian_interface.Path.exists')
|
||||
def test_copy_chk_file_from_previous_step_current_exists(self, mock_exists, mock_copy):
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.shutil.copy")
|
||||
@mock.patch("diceplayer.shared.interface.gaussian_interface.Path.exists")
|
||||
def test_copy_chk_file_from_previous_step_current_exists(
|
||||
self, mock_exists, mock_copy
|
||||
):
|
||||
gaussian_interface = GaussianInterface()
|
||||
gaussian_interface.configure(self.config, System())
|
||||
|
||||
@@ -109,5 +111,5 @@ class TestGaussianInterface(unittest.TestCase):
|
||||
# gaussian_interface._copy_chk_file_from_previous_step.assert_called_once_with(2)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user