コード例 #1
0
def test_template_occurence_scorer_tree_one_node():
    rt = ReactionTree()
    rt.root = Molecule(smiles="CCCCOc1ccc(CC(=O)N(C)O)cc1")
    rt.graph.add_node(rt.root)
    scorer = AverageTemplateOccurenceScorer()

    assert scorer(rt) == 0.0
コード例 #2
0
def test_template_occurence_scorer_no_metadata(shared_datadir, default_config):
    search_tree = SearchTree.from_json(
        shared_datadir / "tree_without_repetition.json", default_config)
    nodes = list(search_tree.graph())
    scorer = AverageTemplateOccurenceScorer()

    assert scorer(nodes[1]) == 0
コード例 #3
0
def test_template_occurence_scorer(shared_datadir, default_config):
    search_tree = SearchTree.from_json(
        shared_datadir / "tree_without_repetition.json", default_config)
    nodes = list(search_tree.graph())
    nodes[0][nodes[1]]["action"].metadata["library_occurence"] = 5
    scorer = AverageTemplateOccurenceScorer()

    assert scorer(nodes[0]) == 0
    assert scorer(nodes[1]) == 5
コード例 #4
0
def test_template_occurence_scorer_tree(load_reaction_tree):
    tree = ReactionTree.from_dict(load_reaction_tree("sample_reaction.json"))
    scorer = AverageTemplateOccurenceScorer()

    assert scorer(tree) == 0