コード例 #1
0
def test_sidechain_repository(sidechain_mols, model_sort_key):
    sc_repo = repo.create_sidechain_repository()
    ids = sc_repo.save(sidechain_mols)
    data = list(sc_repo.load(ids))
    data.sort(key=model_sort_key)

    assert data == sidechain_mols
def test_initialize(initialized_repository):
    assert len(list(repo.create_backbone_repository().load())) == 3
    assert len(list(repo.create_connection_repository().load())) == 2
    assert len(list(repo.create_template_repository().load())) == 3
    assert len(list(repo.create_sidechain_repository().load())) == 3
    assert len(list(repo.create_monomer_repository().load())) == 4
    assert len(list(repo.create_regiosqm_repository().load())) == 3
    assert len(list(repo.create_pka_repository().load())) == 3
def test_initialize_predictions_only(partial_initialized_repository):
    exporter = RegioSQMExporter()
    exporter.export_regiosqm_smiles_file()

    initializer = CPMGInitializer()
    initializer._initialize_predictions_only()

    assert len(list(repo.create_backbone_repository().load())) == 3
    assert len(list(repo.create_connection_repository().load())) == 2
    assert len(list(repo.create_template_repository().load())) == 3
    assert len(list(repo.create_sidechain_repository().load())) == 3
    assert len(list(repo.create_monomer_repository().load())) == 4
    assert len(list(repo.create_regiosqm_repository().load())) == 3
    assert len(list(repo.create_pka_repository().load())) == 3
コード例 #4
0
def test_sidechain_importer(json_importer, independent_importers):
    sidechain_importer = importers.SidechainImporter(json_importer)
    ids = sidechain_importer.import_data()

    sidechain_repo = repo.create_sidechain_repository()
    connection_repo = repo.create_connection_repository()
    sidechain_data = list(sidechain_repo.load(ids))
    sidechain_docs = json_importer.load(sidechain_importer.saver.TYPE.STRING)
    connection_data = list(connection_repo.load())
    kekules = [doc['kekule'] for doc in sidechain_docs]
    connections = [mol.kekule for mol in connection_data]

    assert(len(sidechain_data) == 3)
    for mol in sidechain_data:
        assert(mol._id != None)
        assert(mol.shared_id != None)
        assert(mol.kekule in kekules)
        assert(mol.connection in connections)
        kekules.remove(mol.kekule)
def test_initialize_mol_only(partial_initialized_repository):
    assert len(list(repo.create_backbone_repository().load())) == 3
    assert len(list(repo.create_connection_repository().load())) == 2
    assert len(list(repo.create_template_repository().load())) == 3
    assert len(list(repo.create_sidechain_repository().load())) == 3
    assert len(list(repo.create_monomer_repository().load())) == 4
コード例 #6
0
 def __init__(self):
     self.backbone_repo = repo.create_backbone_repository()
     self.sidechain_repo = repo.create_sidechain_repository()
     super().__init__(repo.create_monomer_repository())
コード例 #7
0
 def __init__(self):
     self.connection_repo = repo.create_connection_repository()
     self.sidechain_repo = repo.create_sidechain_repository()
     super().__init__(self.sidechain_repo)
コード例 #8
0
 def __init__(self):
     self.sidechain_repo = repo.create_sidechain_repository()
     self.monomer_repo = repo.create_monomer_repository()
     self.template_repo = repo.create_template_repository()
     super().__init__(repo.create_reaction_repository())
コード例 #9
0
 def __init__(self):
     self.sidechain_repo = repo.create_sidechain_repository()
     self.monomer_repo = repo.create_monomer_repository()
コード例 #10
0
def test_sidechain_repository_fail():
    sc_repo = repo.create_sidechain_repository()

    _ = sc_repo.save(['dne'])

    assert len(sc_repo.failed_instances) == 1
コード例 #11
0
 def __init__(self, loader):
     self.connections = set()
     self.loader = loader
     self.saver = repo.create_sidechain_repository()