Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 21, 2024
1 parent 49bce4b commit f6005bf
Show file tree
Hide file tree
Showing 125 changed files with 479 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CI/functional_tests/test_molten_salts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Perform a functional test on two molten salts.
"""

from typing import Tuple

import pytest
Expand Down Expand Up @@ -73,6 +74,7 @@ def mdsuite_project(traj_files, tmp_path) -> mds.Project:
-------
project: mdsuite.Project
An MDSuite project to be tested.
"""
project = mds.Project(storage_path=tmp_path.as_posix())

Expand Down Expand Up @@ -114,6 +116,7 @@ def test_analysis(mdsuite_project):
-----
See the link below for similar data for CNs for molten salts.
https://link.springer.com/article/10.1007/s10800-018-1197-z
"""
NaCl_experiment = mdsuite_project.experiments.NaCl
KCl_experiment = mdsuite_project.experiments.KCl
Expand Down
3 changes: 3 additions & 0 deletions CI/functional_tests/test_water_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Functional test for the analysis of a GROMACS water simulation.
"""

from typing import List

import pytest
Expand Down Expand Up @@ -65,6 +66,7 @@ def mdsuite_project(traj_files, tmp_path) -> mdsuite.Project:
-------
project: mdsuite.Project
An MDSuite project to be tested.
"""
gmx_units = Units(
time=1e-12,
Expand Down Expand Up @@ -102,6 +104,7 @@ def test_water_analysis(mdsuite_project):
-----
The diffusion, angle, and eventually coordination data tested here are comparable
with values taken from experiment and published studies.
"""
water = mdsuite_project.experiments["water_sim"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import json
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import dataclasses
import os

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
values.
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down Expand Up @@ -61,6 +62,7 @@ def test_project(traj_file, true_values, tmp_path, desired_memory):
Notes
-----
Test uncertainty is very high!
"""
with mds.utils.helpers.change_memory_fraction(desired_memory=desired_memory):
os.chdir(tmp_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import dataclasses
import os

Expand Down Expand Up @@ -103,9 +104,7 @@ def test_calculator(tmp_path, desired_memory):
time_should_be = time_step * np.arange(0, vacf_range) * units.time
thermal_vel_SI = np.sqrt(3 * kT / mass) * units.length / units.time
relaxation_time_SI = relaxation_time * units.time
vacf_should_be = thermal_vel_SI**2 * np.exp(
-time_should_be / relaxation_time_SI
)
vacf_should_be = thermal_vel_SI**2 * np.exp(-time_should_be / relaxation_time_SI)
diff_coeff_should_be = diff_coeff * units.length**2 / units.time

np.testing.assert_allclose(res["time"], time_should_be, atol=1e-6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import os

import pytest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Test the outcome of molecular mapping.
"""

from typing import List, Tuple

import pytest
Expand Down Expand Up @@ -73,6 +74,7 @@ def mdsuite_project(traj_files, tmp_path) -> mdsuite.Project:
-------
project: mdsuite.Project
An MDSuite project to be tested.
"""
water_files = traj_files[0]
bmim_file = traj_files[1]
Expand Down Expand Up @@ -138,6 +140,7 @@ def test_water_molecule_smiles(self, mdsuite_project):
-------
Tests that the molecule groups detected are done so correctly and that the
constructed trajectory is also correct.
"""
reference_molecules = {
"water": MoleculeInfo(
Expand Down Expand Up @@ -187,6 +190,7 @@ def test_water_molecule_reference_dict(self, mdsuite_project):
-------
Tests that the molecule groups detected are done so correctly and that the
constructed trajectory is also correct.
"""
mdsuite_project.experiments["ligand_water"].species["OW"].mass = [15.999]
mdsuite_project.experiments["ligand_water"].species["HW1"].mass = [1.00784]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_from_project(mdsuite_project):
Notes
-----
Does not check actual values just runs the transformation.
"""
mdsuite_project.run.CoordinateUnwrapper()

Expand All @@ -57,6 +58,7 @@ def test_from_project_twice(mdsuite_project):
Notes
-----
Does not check actual values just runs the transformation.
"""
mdsuite_project.run.CoordinateUnwrapper()
mdsuite_project.run.CoordinateUnwrapper()
Expand All @@ -69,6 +71,7 @@ def test_from_experiment(mdsuite_project):
Notes
-----
Does not check actual values just runs the transformation.
"""
mdsuite_project.experiments.NaCl.run.CoordinateUnwrapper()

Expand All @@ -81,6 +84,7 @@ def test_from_experiment_twice(mdsuite_project):
Notes
-----
Does not check actual values just runs the transformation.
"""
mdsuite_project.experiments.NaCl.run.CoordinateUnwrapper()
mdsuite_project.experiments.NaCl.run.CoordinateUnwrapper()
Expand Down
2 changes: 2 additions & 0 deletions CI/integration_tests/visualizer/znvis_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Test that the visualizer runs.
"""

import os
import tempfile
import time
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_run(self):
test isn't prematurely closed and passes when it should have failed. For now
120 seconds is more than enough time for this test but we can think of some
improvements later.
"""
process = MDSuiteProcess(target=self._run_app)
process.start()
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/database/test_experiment_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Summary
-------
"""

import dataclasses
import os

Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/database/test_file_read.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test MDSuite file reading."""

import numpy as np

import mdsuite
Expand Down
6 changes: 6 additions & 0 deletions CI/unit_tests/database/test_simulation_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
-------
Test for module for the simulation database.
"""

import os
import tempfile
import unittest
Expand All @@ -43,6 +44,7 @@ def test_build_path_input(self):
Returns
-------
Asserts that the correct path is generated for a given input.
"""
temp_dir = tempfile.TemporaryDirectory()
os.chdir(temp_dir.name)
Expand Down Expand Up @@ -70,6 +72,7 @@ def test_add_dataset(self):
Returns
-------
Assert that a dataset of the correct size is built.
"""
temp_dir = tempfile.TemporaryDirectory()
os.chdir(temp_dir.name)
Expand All @@ -93,6 +96,7 @@ def test_resize_array(self):
Returns
-------
Resizes a built dataset and checks that the size is now correct.
"""
temp_dir = tempfile.TemporaryDirectory()
os.chdir(temp_dir.name)
Expand All @@ -118,6 +122,7 @@ def test_database_exists(self):
Returns
-------
Checks for a False and then True result.
"""
temp_dir = tempfile.TemporaryDirectory()
os.chdir(temp_dir.name)
Expand All @@ -135,6 +140,7 @@ def test_check_existence(self):
Returns
-------
Checks for a True and False result.
"""
temp_dir = tempfile.TemporaryDirectory()
os.chdir(temp_dir.name)
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/experiment/test_Experiment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test MDSuite Experiment class."""

import pytest

from mdsuite.experiment.experiment import Experiment
Expand Down
1 change: 1 addition & 0 deletions CI/unit_tests/experiment/test_run_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Description:
"""

from unittest.mock import Mock

from mdsuite.experiment.run import RunComputation
Expand Down
4 changes: 4 additions & 0 deletions CI/unit_tests/graph_modules/test_molecular_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-------
Module to test the molecular graph module.
"""

from dataclasses import dataclass
from pathlib import Path

Expand Down Expand Up @@ -54,6 +55,7 @@ class SmilesTestData:
species : dict
A dictionary of species information for the test stating how many of each
particle species is in the group e.g. {'C': 6, 'H': 14}
"""

name: str
Expand All @@ -78,6 +80,7 @@ def test_apply_system_cutoff(self):
Returns
-------
Checks whether or not the cutoff has been enforced.
"""
zeros = np.array([0, 0, 0, 0, 0])
cutoff_data = [
Expand Down Expand Up @@ -123,6 +126,7 @@ def test_build_smiles_graph(self):
-------
This test checks that the SMILES graphs built by the module return the correct
molecule information for several scenarios.
"""
emim = SmilesTestData(
name="emim",
Expand Down
Loading

0 comments on commit f6005bf

Please sign in to comment.