

def test_nan_error(self):
    shutil.copyfile(os.path.join(test_dir, 'thiane_nan.inp'), os.path.join(scr_dir, 'thiane_nan.inp'))
    shutil.copyfile(os.path.join(test_dir, 'thiane_nan.out'), os.path.join(scr_dir, 'thiane_nan.out'))
    h = QChemErrorHandler(input_file='thiane_nan.inp', output_file='thiane_nan.out')
    has_error = h.check()
    self.assertTrue(has_error)
    d = h.correct()
    self.assertEqual(self, {
        'errors': ['NAN values'],
        'actions': ['use tighter grid'],
    })
    with open(os.path.join(test_dir, 'thiane_nan_dense_grid.inp')) as f:
        ref = [line.strip() for line in f.readlines()]
    with open(os.path.join(scr_dir, 'thiane_nan.inp')) as f:
        ans = [line.strip() for line in f.readlines()]
    self.assertEqual(ref, ans)
    shutil.copyfile(os.path.join(test_dir, 'thiane_nan_dense_grid.inp'), os.path.join(scr_dir, 'thiane_nan_dense_grid.inp'))
    shutil.copyfile(os.path.join(test_dir, 'thiane_nan.out'), os.path.join(scr_dir, 'thiane_nan.out'))
    h = QChemErrorHandler(input_file='thiane_nan_dense_grid.inp', output_file='thiane_nan.out')
    has_error = h.check()
    self.assertTrue(has_error)
    d = h.correct()
    self.assertEqual(d, {
        'errors': ['NAN values'],
        'actions': None,
    })
    shutil.copyfile(os.path.join(test_dir, 'h2o_nan.qcinp'), os.path.join(scr_dir, 'h2o_nan.qcinp'))
    shutil.copyfile(os.path.join(test_dir, 'h2o_nan.qcout'), os.path.join(scr_dir, 'h2o_nan.qcout'))
    h = QChemErrorHandler(input_file='h2o_nan.qcinp', output_file='h2o_nan.qcout')
    has_error = h.check()
    self.assertTrue(has_error)
    d = h.correct()
    self.assertEqual(d, {
        'errors': ['NAN values'],
        'actions': ['use tighter grid'],
    })
    with open(os.path.join(test_dir, 'h2o_nan_dense_grid.qcinp')) as f:
        ref = [line.strip() for line in f.readlines()]
    with open(os.path.join(scr_dir, 'h2o_nan.qcinp')) as f:
        ans = [line.strip() for line in f.readlines()]
    self.assertEqual(ref, ans)

dataset/ETHPy150Open materialsproject/custodian/custodian/qchem/tests/test_handlers.py QChemErrorHandlerTest.test_nan_error/VarMisuse@104/168 `d`->`self`