Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-S-Rosen committed May 21, 2024
1 parent 197177e commit 64ebcb8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custodian/vasp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def correct(self, directory="./"):
)
self.error_count["algo_tet"] += 1

if "auto_nbands" in self.errors and not (nbands := self._get_nbands_from_outcar(directory)):
if "auto_nbands" in self.errors and (nbands := self._get_nbands_from_outcar(directory)):
nelect = load_outcar(os.path.join(directory, "OUTCAR")).nelect
if nelect and nbands > 2 * nelect:
self.error_count["auto_nbands"] += 1
Expand Down
5 changes: 4 additions & 1 deletion tests/vasp/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,11 @@ def test_auto_nbands(self) -> None:
shutil.copy("OUTCAR_auto_nbands", "OUTCAR")
handler = VaspErrorHandler("vasp.auto_nbands")
handler.check()
dct = handler.correct()
with pytest.warns(UserWarning, match="NBANDS seems to be too high"):
dct = handler.correct()
assert "auto_nbands" in dct["errors"]



class AliasingErrorHandlerTest(PymatgenTest):
def setUp(self) -> None:
Expand Down

0 comments on commit 64ebcb8

Please sign in to comment.