Coverage for gpaw/test/fileio/test_gap.py: 90%

10 statements  

« prev     ^ index     » next       coverage.py v7.7.1, created at 2025-07-08 00:17 +0000

1import pytest 

2 

3 

4def test_gap_in_txt(gpw_files, needs_ase_master): 

5 gpw = gpw_files['h2_pw'] 

6 txt = gpw.with_suffix('.txt') 

7 for line in txt.read_text().splitlines(): 

8 if line.startswith('Gap:'): 

9 gap = float(line.split()[1]) 

10 assert gap == pytest.approx(11.296, abs=0.001) 

11 return 

12 raise ValueError(f'No gap in text file: {txt}')