예제 #1
0
def loaded_sdf(
    elastic_repository: ElasticRepository,
    resource_loader: Callable[[str], str],
) -> IndigoRecord:
    resource = resource_loader("resources/rand_queries_small.sdf")
    sdf = iterate_file(Path(resource))
    elastic_repository.index_records(sdf, chunk_size=10)
    time.sleep(5)
    return next(
        iterate_file(Path(resource_loader("resources/rand_queries_small.sdf")))
    )
예제 #2
0
def loaded_sdf(
    elastic_repository_molecule: ElasticRepository,
    resource_loader,
) -> IndigoRecordMolecule:
    resource = resource_loader("molecules/rand_queries_small.sdf")
    sdf = iterate_file(Path(resource))
    elastic_repository_molecule.index_records(sdf, chunk_size=10)
    time.sleep(5)
    return next(
        iterate_file(Path(resource_loader("molecules/rand_queries_small.sdf")))
    )
예제 #3
0
def test_create_index(
    elastic_repository_molecule: ElasticRepository,
    resource_loader,
):
    sdf = iterate_file(
        Path(resource_loader("molecules/rand_queries_small.sdf")))
    elastic_repository_molecule.index_records(sdf, chunk_size=10)
예제 #4
0
def test_create_index(
    elastic_repository: ElasticRepository,
    resource_loader: Callable[[str], str],
):
    sdf = iterate_file(
        Path(resource_loader("resources/rand_queries_small.sdf")))
    elastic_repository.index_records(sdf, chunk_size=10)
예제 #5
0
파일: test_helpers.py 프로젝트: rbri/Indigo
def test_iterate_sdf(resource_loader: Callable[[str], str]):
    results = []
    for step in range(0, 2):
        if 0 == step:
            sdf = helpers.iterate_sdf(
                resource_loader("resources/rand_queries_small.sdf"))
        else:
            sdf = helpers.iterate_file(
                Path(resource_loader("resources/rand_queries_small.sdf")))
        i = 0
        for i, _ in enumerate(sdf, start=1):
            pass
        results.append(i)
    assert results[0] == results[1]
예제 #6
0
파일: test_helpers.py 프로젝트: rbri/Indigo
def test_iterate_cml(resource_loader: Callable[[str], str]):
    results = []
    for step in range(0, 2):
        if 0 == step:
            cml = helpers.iterate_cml(
                resource_loader("resources/tetrahedral-all.cml"))
        else:
            cml = helpers.iterate_file(
                Path(resource_loader("resources/tetrahedral-all.cml")))
        i = 0
        for i, _ in enumerate(cml, start=1):
            pass
        results.append(i)
    assert results[0] == results[1]
예제 #7
0
파일: test_helpers.py 프로젝트: rbri/Indigo
def test_iterate_smiles(resource_loader: Callable[[str], str]):
    results = []
    for step in range(0, 2):
        if 0 == step:
            smiles = helpers.iterate_smiles(
                resource_loader("resources/pubchem_slice_50.smi"))
        else:
            smiles = helpers.iterate_file(
                Path(resource_loader("resources/pubchem_slice_50.smi")))
        i = 0
        for i, _ in enumerate(smiles, start=1):
            pass
        results.append(i)
    assert results[0] == results[1]
예제 #8
0
def test_range_search(
    elastic_repository_molecule: ElasticRepository,
    indigo_fixture: Indigo,
    resource_loader,
):
    for i, item in enumerate(
            iterate_file(
                Path(resource_loader("molecules/rand_queries_small.sdf")))):
        item.ind_number = i
        elastic_repository_molecule.index_record(item)
    result = elastic_repository_molecule.filter(ind_number=RangeQuery(1, 10))
    i = 0
    for _ in result:
        i += 1
    assert i == 10