diff --git a/plasmapy/classes/sources/openpmd_hdf5.py b/plasmapy/classes/sources/openpmd_hdf5.py index 802a4d1a5f..68819adb60 100644 --- a/plasmapy/classes/sources/openpmd_hdf5.py +++ b/plasmapy/classes/sources/openpmd_hdf5.py @@ -76,7 +76,6 @@ def __init__(self, hdf5, **kwargs): self.subname = tuple(self.h5['data'])[0] - def _check_valid_openpmd_version(self): try: openPMD_version = self.h5.attrs["openPMD"].decode('utf-8') @@ -117,7 +116,7 @@ def charge_density(self): @classmethod def is_datasource_for(cls, **kwargs): - if not "hdf5" in kwargs: + if "hdf5" not in kwargs: return False hdf5 = kwargs.get("hdf5") @@ -127,7 +126,7 @@ def is_datasource_for(cls, **kwargs): if not isfile: raise FileNotFoundError(f"Could not find file: '{hdf5}'") - if not "openPMD" in kwargs and isfile: + if "openPMD" not in kwargs and isfile: h5 = h5py.File(hdf5) try: openPMD = h5.attrs["openPMD"] diff --git a/plasmapy/classes/sources/tests/test_openpmd_hdf5.py b/plasmapy/classes/sources/tests/test_openpmd_hdf5.py index 3a16d11a02..44f05d07eb 100644 --- a/plasmapy/classes/sources/tests/test_openpmd_hdf5.py +++ b/plasmapy/classes/sources/tests/test_openpmd_hdf5.py @@ -49,7 +49,7 @@ def test_correct_shape_charge_density(self): units_test_table = [ - ((1., 1., 0., -1., 0. ,0., 2.), + ((1., 1., 0., -1., 0., 0., 2.), u.m * u.kg / u.amp * u.cd ** 2), ((1, 0, 1, 2, 0, 0, 0), u.m * u.s * u.amp ** 2), @@ -58,6 +58,8 @@ def test_correct_shape_charge_density(self): ([2, 1, -3, -2, 0, 0, 0], u.ohm) ] + + @pytest.mark.parametrize("openPMD_dims, expected", units_test_table) def test_fetch_units(openPMD_dims, expected: Union[Tuple, List]): units = openpmd_hdf5._fetch_units(openPMD_dims) diff --git a/plasmapy/data/test/__init__.py b/plasmapy/data/test/__init__.py index d766397278..e99f623c32 100644 --- a/plasmapy/data/test/__init__.py +++ b/plasmapy/data/test/__init__.py @@ -1,10 +1,7 @@ -from pathlib import Path import os import glob import plasmapy -rootdir = Path(os.path.join(os.path.dirname(plasmapy.__file__), - "data", - "test")) +rootdir = os.path.join(os.path.dirname(plasmapy.__file__), "data", "test")) file_list = glob.glob(os.path.join(rootdir, '*.[!p]*'))