diff --git a/src/custodian/vasp/handlers.py b/src/custodian/vasp/handlers.py index 875d13eb..2b152176 100644 --- a/src/custodian/vasp/handlers.py +++ b/src/custodian/vasp/handlers.py @@ -735,8 +735,7 @@ def correct(self, directory="./"): UserWarning, ) - elif (nbands := vi["INCAR"].get("NBANDS")): - + elif nbands := vi["INCAR"].get("NBANDS"): kpar = vi["INCAR"].get("KPAR", 1) ncore = vi["INCAR"].get("NCORE", 1) # If the user set an NBANDS that isn't compatible with parallelization settings, diff --git a/tests/vasp/test_handlers.py b/tests/vasp/test_handlers.py index aed63075..56a9b91a 100644 --- a/tests/vasp/test_handlers.py +++ b/tests/vasp/test_handlers.py @@ -606,19 +606,16 @@ def test_auto_nbands(self) -> None: assert "auto_nbands" in dct["errors"] def test_auto_nbands_bad_parallelization(self) -> None: - shutil.copy("OUTCAR_auto_nbands_parallel", "OUTCAR") # hacky way to deal with custodian CI unzipping test files Incar.from_file(zpath("INCAR.auto_nbands_parallel")).write_file("INCAR") handler = VaspErrorHandler(zpath("vasp.auto_nbands")) handler.check() - with pytest.warns(UserWarning, match = "setting was incompatible with your parallelization"): + with pytest.warns(UserWarning, match="setting was incompatible with your parallelization"): dct = handler.correct() assert "auto_nbands" in dct["errors"] - assert dct["actions"] == [ - {"dict": "INCAR", "action": {"_set": {"NBANDS": 64}}} - ] + assert dct["actions"] == [{"dict": "INCAR", "action": {"_set": {"NBANDS": 64}}}] class AliasingErrorHandlerTest(PymatgenTest):