From e3fb42eac96606f8a1f8b9b2caa9094b3580fc95 Mon Sep 17 00:00:00 2001 From: yaosk Date: Mon, 28 Oct 2024 19:38:19 +0800 Subject: [PATCH] opt code --- tests/test_vasp_poscar_to_system.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_vasp_poscar_to_system.py b/tests/test_vasp_poscar_to_system.py index 16cd64b8..c34d85ee 100644 --- a/tests/test_vasp_poscar_to_system.py +++ b/tests/test_vasp_poscar_to_system.py @@ -20,6 +20,12 @@ def test_move_flags(self): class TestPOSCARMoveFlags(unittest.TestCase): + def setUp(self): + self.tmp_file = "POSCAR.tmp.1" + + def tearDown(self): + if os.path.exists(self.tmp_file): + os.remove(self.tmp_file) def test_move_flags_error1(self): with self.assertRaisesRegex(RuntimeError, "Invalid move flags.*?"): dpdata.System().from_vasp_poscar(os.path.join("poscars", "POSCAR.oh.err1")) @@ -36,7 +42,7 @@ def test_move_flags_error3(self): with self.assertRaisesRegex( RuntimeError, "Invalid move flags:.*?should be a list of 3 bools" ): - system.to_vasp_poscar("POSCAR.tmp.1") + system.to_vasp_poscar(self.tmp_file) class TestPOSCARDirect(unittest.TestCase, TestPOSCARoh):