Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[merge before other PRs] ruff updates #580

Merged
merged 23 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CI/functional_tests/test_molten_salts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@

@pytest.fixture(scope="session")
def traj_files(tmp_path_factory) -> Tuple[str, str]:
"""
Download trajectory file into a temporary directory and keep it for all tests
"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl_file = DataHub(
Expand Down
5 changes: 2 additions & 3 deletions CI/functional_tests/test_water_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@pytest.fixture(scope="session")
def traj_files(tmp_path_factory) -> List[str]:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

water = DataHub(
Expand Down Expand Up @@ -95,14 +95,13 @@ def mdsuite_project(traj_files, tmp_path) -> mdsuite.Project:

def test_water_analysis(mdsuite_project):
"""
Run a functional test by performing a study on an MD simulation of water
Run a functional test by performing a study on an MD simulation of water.

Notes
-----
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"]

water_molecule = mds.Molecule(
Expand Down
8 changes: 4 additions & 4 deletions CI/integration_tests/calculators/__test_structure_factor.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -50,15 +50,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="StructureFactor.json")


def test_structure_factor_project(traj_files, true_values, tmp_path):
"""Test the structure_factor called from the project class"""
"""Test the structure_factor called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -85,7 +85,7 @@ def test_structure_factor_project(traj_files, true_values, tmp_path):


def test_structure_factor_experiment(traj_files, true_values, tmp_path):
"""Test the structure_factor called from the experiment class"""
"""Test the structure_factor called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -51,15 +51,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="EinsteinHelfandThermanKinaci.json")


def test_project(traj_files, true_values, tmp_path):
"""Test the einstein_helfand_thermal_kinaci called from the project class"""
"""Test the einstein_helfand_thermal_kinaci called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -81,7 +81,7 @@ def test_project(traj_files, true_values, tmp_path):


def test_experiment(traj_files, true_values, tmp_path):
"""Test the einstein_helfand_thermal_kinaci called from the experiment class"""
"""Test the einstein_helfand_thermal_kinaci called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -50,15 +50,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="GreenKuboThermalConductivity.json")


def test_roject(traj_files, true_values, tmp_path):
"""Test the green_kubo_thermal_conductivity called from the project class"""
"""Test the green_kubo_thermal_conductivity called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -80,7 +80,7 @@ def test_roject(traj_files, true_values, tmp_path):


def test_experiment(traj_files, true_values, tmp_path):
"""Test the green_kubo_thermal_conductivity called from the experiment class"""
"""Test the green_kubo_thermal_conductivity called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -50,15 +50,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="GreenKuboViscosity.json")


def test_gkv_project(traj_files, true_values, tmp_path):
"""Test the gkv called from the project class"""
"""Test the gkv called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -80,7 +80,7 @@ def test_gkv_project(traj_files, true_values, tmp_path):


def test_gkv_experiment(traj_files, true_values, tmp_path):
"""Test the gkv called from the experiment class"""
"""Test the gkv called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -51,15 +51,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="GreenKuboViscosityFlux.json")


def test_project(traj_files, true_values, tmp_path):
"""Test the green_kubo_viscosity_flux called from the project class"""
"""Test the green_kubo_viscosity_flux called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -81,7 +81,7 @@ def test_project(traj_files, true_values, tmp_path):


def test_experiment(traj_files, true_values, tmp_path):
"""Test the green_kubo_viscosity_flux called from the experiment class"""
"""Test the green_kubo_viscosity_flux called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -50,15 +50,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="NernstEinsteinIonicConductivity.json")


def test_neic_project(traj_files, true_values, tmp_path):
"""Test the nernst_einstein_ionic_conductivity called from the project class"""
"""Test the nernst_einstein_ionic_conductivity called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -80,7 +80,7 @@ def test_neic_project(traj_files, true_values, tmp_path):


def test_neic_experiment(traj_files, true_values, tmp_path):
"""Test the nernst_einstein_ionic_conductivity called from the experiment class"""
"""Test the nernst_einstein_ionic_conductivity called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -48,15 +48,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="AngularDistributionFunction.json")


def test_project(traj_file, true_values, tmp_path):
"""Test the ADF called from the project class"""
"""Test the ADF called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
6 changes: 3 additions & 3 deletions CI/integration_tests/calculators/test_coordination_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -48,15 +48,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.1"
)
return NaCl.get_analysis(analysis="CoordinationNumbers.json")


def test_project(traj_file, true_values, tmp_path):
"""Test the CN called from the project class"""
"""Test the CN called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -53,15 +53,15 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="RadialDistributionFunction.json")


def test_eddc_project(traj_file, true_values, tmp_path):
"""Test the EinsteinDistinctDiffusionCoefficients called from the project class"""
"""Test the EinsteinDistinctDiffusionCoefficients called from the project class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand All @@ -88,9 +88,7 @@ def test_eddc_project(traj_file, true_values, tmp_path):


def test_eddc_experiment(traj_file, true_values, tmp_path):
"""
Test the EinsteinDistinctDiffusionCoefficients called from the experiment class
"""
"""Test the EinsteinDistinctDiffusionCoefficients called from the experiment class."""
os.chdir(tmp_path)
project = mds.Project()
project.add_experiment(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

@pytest.fixture(scope="session")
def traj_file(tmp_path_factory) -> str:
"""Download trajectory file into a temporary directory and keep it for all tests"""
"""Download trajectory file into a temporary directory and keep it for all tests."""
temporary_path = tmp_path_factory.getbasetemp()

NaCl = DataHub(
Expand All @@ -47,18 +47,18 @@ def traj_file(tmp_path_factory) -> str:

@pytest.fixture(scope="session")
def true_values() -> dict:
"""Example fixture for downloading analysis results from github"""
"""Example fixture for downloading analysis results from github."""
NaCl = DataHub(
url="https://github.com/zincware/DataHub/tree/main/NaCl_gk_i_q", tag="v0.1.0"
)
return NaCl.get_analysis(analysis="EinsteinHelfandIonicConductivity.json")


def test_project(traj_file, true_values, tmp_path):
"""Test the Einstein_Helfand_Ionic_Conductivity called from the project class
"""Test the Einstein_Helfand_Ionic_Conductivity called from the project class.

Notes
------
-----
Test uncertainty is very high!
"""
os.chdir(tmp_path)
Expand Down
Loading