def _run_test_bundles(tmp_path, fmt, reffmt, ext, data_dir): '''Test functionality related to creating archive of basis set''' tmp_path = str(tmp_path) # Needed for python 3.5 bs_ext = bse.writers.get_format_extension(fmt) ref_ext = bse.refconverters.get_format_extension(reffmt) filename = "bundletest_" + fmt + "_" + reffmt + ext filepath = os.path.join(tmp_path, filename) bse.create_bundle(filepath, fmt, reffmt, None, data_dir) extract_dir = "extract_" + filename extract_path = os.path.join(tmp_path, extract_dir) _extract_all(filepath, extract_path) # Keep track of all the basis sets we have found # Start with all found in the data dir, and remove # each time we process one all_bs = [] for k, v in bse.get_metadata(data_dir).items(): for ver in v['versions'].keys(): all_bs.append((k, ver)) all_ref = all_bs.copy() for root, dirs, files in os.walk(extract_path): for basename in files: if basename == 'README.txt': continue fpath = os.path.join(root, basename) name, ver = basename.split('.')[:2] tr_name = bse.misc.basis_name_from_filename(name) if basename.endswith('.ref' + ref_ext): compare_data = bse.get_references(tr_name, fmt=reffmt, version=ver, data_dir=data_dir) all_ref.remove((name, ver)) elif basename.endswith(bs_ext): compare_data = bse.get_basis(name, fmt=fmt, version=ver, data_dir=data_dir) all_bs.remove((name, ver)) elif basename.endswith('.family_notes'): compare_data = bse.get_family_notes(name, data_dir) elif basename.endswith('.notes'): compare_data = bse.get_basis_notes(name, data_dir) else: raise RuntimeError("Unknown file found: " + fpath) with open(fpath, 'r', encoding='utf-8') as ftmp: assert compare_data == ftmp.read() assert len(all_bs) == 0 assert len(all_ref) == 0
def test_notes(basis_name): """Test getting family, family notes, and basis set notes """ bse.get_basis_notes(basis_name) bse.has_basis_notes(basis_name)
def test_notes(basis_name): """Test getting family, family notes, and basis set notes """ bse.get_basis_notes(basis_name) fam = bse.get_basis_family(basis_name) bse.get_family_notes(fam)