11from __future__ import annotations
22
3- import os
4-
53from pytest import approx
64
75from pymatgen .core .structure import Molecule
119__author__ = "Xin Chen, [email protected] " 1210
1311
14- test_dir = f"{ TEST_FILES_DIR } /molecules"
12+ TEST_DIR = f"{ TEST_FILES_DIR } /molecules"
1513
1614geometry_string = """GEOMETRY
1715smooth conservepoints
@@ -256,13 +254,13 @@ def test_main(self):
256254 task = AdfTask ("optimize" , ** rhb18 )
257255 inp = AdfInput (task )
258256 inp .write_file (mol , tmp_file )
259- s = readfile (test_dir / " adf" / " RhB18_adf.inp" )
260- assert readfile (tmp_file ) == s
257+ expected = readfile (f" { TEST_DIR } / adf/ RhB18_adf.inp" )
258+ assert readfile (tmp_file ) == expected
261259
262260
263261class TestAdfOutput :
264262 def test_analytical_freq (self ):
265- filename = os . path . join ( str ( test_dir ), " adf" , " analytical_freq" , " adf.out")
263+ filename = f" { TEST_DIR } / adf/ analytical_freq/ adf.out"
266264 o = AdfOutput (filename )
267265 assert o .final_energy == approx (- 0.54340325 )
268266 assert len (o .energies ) == 4
@@ -275,7 +273,7 @@ def test_analytical_freq(self):
275273 assert o .normal_modes [0 ][8 ] == approx (- 0.562 )
276274
277275 def test_numerical_freq (self ):
278- filename = os . path . join ( str ( test_dir ), " adf" , " numerical_freq" , " adf.out")
276+ filename = f" { TEST_DIR } / adf/ numerical_freq/ adf.out"
279277 o = AdfOutput (filename )
280278 assert o .freq_type == "Numerical"
281279 assert len (o .final_structure ) == 4
@@ -291,7 +289,7 @@ def test_numerical_freq(self):
291289 assert o .normal_modes [1 ][9 ] == approx (- 0.536 )
292290
293291 def test_single_point (self ):
294- filename = os . path . join ( str ( test_dir ), " adf" , "sp" , " adf.out")
292+ filename = f" { TEST_DIR } / adf/sp/ adf.out"
295293 o = AdfOutput (filename )
296294 assert o .final_energy == approx (- 0.74399276 )
297295 assert len (o .final_structure ) == 4
0 commit comments