From d0c6b5b99f577fcb92304c94c48f213b674a6c77 Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Wed, 11 Sep 2024 20:03:03 +0800 Subject: [PATCH] fix error type --- chgnet/utils/vasp_utils.py | 2 +- tests/test_vasp_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chgnet/utils/vasp_utils.py b/chgnet/utils/vasp_utils.py index bfb54a07..5b712262 100644 --- a/chgnet/utils/vasp_utils.py +++ b/chgnet/utils/vasp_utils.py @@ -38,7 +38,7 @@ def parse_vasp_dir( dict: a dictionary of lists with keys for structure, uncorrected_total_energy, energy_per_atom, force, magmom, stress. """ - if os.path.isdir(base_dir) is False: + if not os.path.isdir(base_dir): raise NotADirectoryError(f"{base_dir=} is not a directory") oszicar_path = zpath(f"{base_dir}/OSZICAR") diff --git a/tests/test_vasp_utils.py b/tests/test_vasp_utils.py index 8def6568..b16c2ad3 100644 --- a/tests/test_vasp_utils.py +++ b/tests/test_vasp_utils.py @@ -62,7 +62,7 @@ def test_parse_vasp_dir_without_magmoms(tmp_path: Path): def test_parse_vasp_dir_no_data(): # test non-existing directory - with pytest.raises(FileNotFoundError, match="is not a directory"): + with pytest.raises(NotADirectoryError, match="is not a directory"): parse_vasp_dir(f"{ROOT}/tests/files/non-existent") # test existing directory without VASP files