repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/test_reactiontree.py | test_reactiontree_from_dict | assert | variable | 13 | import pytest
from aizynthfinder.reactiontree import ReactionTree, SUPPORT_DISTANCES
def test_reactiontree_from_dict(load_reaction_tree):
expected = load_reaction_tree("linear_route.json")
rt = ReactionTree.from_dict(expected)
# Simply check that the to_dict() and from_dict() gives/produces the same dic... | expected | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_search.py | test_one_iteration | pytest.raises | variable | 42 | import random
import pytest
from aizynthfinder.search.breadth_first.search_tree import SearchTree
def test_one_iteration(default_config, setup_policies, setup_stock):
root_smi = "CN1CCC(C(=O)c2cccc(NC(=O)c3ccc(F)cc3)c2F)CC1"
child1_smi = ["CN1CCC(Cl)CC1", "N#Cc1cccc(NC(=O)c2ccc(F)cc2)c1F", "O"]
child2_sm... | StopIteration) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/dfpn/test_search.py | test_search | pytest.raises | variable | 42 | import random
import pytest
from aizynthfinder.search.dfpn.search_tree import SearchTree
def test_search(default_config, setup_policies, setup_stock):
root_smi = "CN1CCC(C(=O)c2cccc(NC(=O)c3ccc(F)cc3)c2F)CC1"
child1_smi = ["CN1CCC(Cl)CC1", "N#Cc1cccc(NC(=O)c2ccc(F)cc2)c1F", "O"]
child2_smi = ["CN1CCC(Cl)... | StopIteration) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_serialization_deserialization | assert | complex_expr | 28 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | root.mol | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_select_leaf_root | assert | complex_expr | 8 | def test_select_leaf_root(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
nodes[0].is_expanded = False
leaf = tree.select_leaf()
assert leaf is | nodes[0] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_select_leaf | assert | complex_expr | 7 | def test_select_leaf(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
leaf = tree.select_leaf()
assert leaf is | nodes[2] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_serialization_deserialization | assert | complex_expr | 25 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_serialization_deserialization(
setup_star_ro... | root.mol | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_serialization_deserialization | assert | complex_expr | 27 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_serialization_deserialization(
setup_star_ro... | root.cost | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_serialization_deserialization | assert | complex_expr | 26 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_serialization_deserialization(
setup_star_ro... | root.value | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_image.py | test_save_molecule_images | assert | complex_expr | 37 | import os
import shutil
import json
from tarfile import TarFile
from pathlib import Path
import pytest
from PIL import Image, ImageDraw
from aizynthfinder.utils import image
from aizynthfinder.chem import TreeMolecule, TemplatedRetroReaction
def new_image():
img = Image.new(mode="RGB", size=(300, 300), color="wh... | nfiles + 2 | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_chaining | assert | complex_expr | 14 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_chaining():
serializer = MoleculeSerializer()
mol1 = TreeMolecule(parent=None, smiles="CCC", transform=1)
mol2 = TreeMolecule(smiles="CCO", parent=mol1)
... | mol2.smiles | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_chaining | assert | complex_expr | 15 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_chaining():
serializer = MoleculeSerializer()
mol1 = TreeMolecule(parent=None, smiles="CCC", transform=1)
mol2 = TreeMolecule(smiles="CCO", parent=mol1)
... | mol1.smiles | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/dfpn/test_nodes.py | test_promising_child | assert | complex_expr | 24 | import pytest
from aizynthfinder.search.dfpn.nodes import MoleculeNode, BIG_INT
from aizynthfinder.search.dfpn import SearchTree
def setup_root(default_config):
def wrapper(smiles):
owner = SearchTree(default_config)
return MoleculeNode.create_root(smiles, config=default_config, owner=owner)
... | BIG_INT - 1 | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_serialize_deserialize_tree | assert_* | complex_expr | 25 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_serialize_deserialize_tree(
... | mocker.ANY) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar.py | test_serialization_deserialization | assert_* | complex_expr | 28 | import numpy as np
from aizynthfinder.search.retrostar.search_tree import SearchTree
from aizynthfinder.chem.serialization import MoleculeSerializer
def test_serialization_deserialization(
mocker, setup_search_tree, tmpdir, default_config
):
tree = setup_search_tree
tree.one_iteration()
mocked_json_d... | mocker.ANY) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_serialize_deserialize_state | assert | complex_expr | 24 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_serialize_deserialize_state(defa... | state0.score | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar.py | test_serialization_deserialization | assert | complex_expr | 44 | import numpy as np
from aizynthfinder.search.retrostar.search_tree import SearchTree
from aizynthfinder.chem.serialization import MoleculeSerializer
def test_serialization_deserialization(
mocker, setup_search_tree, tmpdir, default_config
):
tree = setup_search_tree
tree.one_iteration()
mocked_json_d... | tree.root.mol | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_retro_reaction_copy | assert | complex_expr | 25 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_retro_reaction_copy(get_action):... | reaction.index | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_serialize_deserialize_state | assert | complex_expr | 22 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_serialize_deserialize_state(defa... | state0.mols[0] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_route_to_node | assert | complex_expr | 9 | def test_route_to_node(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
actions, route_nodes = nodes[2].path_to()
assert len(actions) == 2
assert len(nodes) == 3
assert nodes[0] == | route_nodes[0] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_route_to_node | assert | complex_expr | 10 | def test_route_to_node(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
actions, route_nodes = nodes[2].path_to()
assert len(actions) == 2
assert len(nodes) == 3
assert nodes[0] == route_nodes[0]
assert nodes[1] == | route_nodes[1] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_route_to_node | assert | complex_expr | 11 | def test_route_to_node(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
actions, route_nodes = nodes[2].path_to()
assert len(actions) == 2
assert len(nodes) == 3
assert nodes[0] == route_nodes[0]
assert nodes[1] == route_nodes[1]
assert nodes[2] == | route_nodes[2] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_serialization_deserialization | assert | complex_expr | 32 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | reaction.smarts | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_serialization_deserialization | assert | complex_expr | 36 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | grandchild2.mol | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_serialization_deserialization | assert | complex_expr | 31 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_serialization_deserialization(
setup_star_ro... | reaction.smarts | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_serialization_deserialization | assert | complex_expr | 37 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_serialization_deserialization(
setup_star_ro... | grandchild2.mol | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_cat_hdf_trees | assert | complex_expr | 49 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | trees1 + trees2 | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/dfpn/test_nodes.py | test_promising_child | assert | complex_expr | 23 | import pytest
from aizynthfinder.search.dfpn.nodes import MoleculeNode, BIG_INT
from aizynthfinder.search.dfpn import SearchTree
def setup_root(default_config):
def wrapper(smiles):
owner = SearchTree(default_config)
return MoleculeNode.create_root(smiles, config=default_config, owner=owner)
... | node.children[0] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_serialization_deserialization | assert | complex_expr | 33 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | reaction.metadata | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_converstion_to_reaction_tree | assert | complex_expr | 30 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_converstion_to_reaction_tree(
setup_star_roo... | root.mol.inchi_key | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_image.py | test_image_factory | assert | complex_expr | 39 | import os
import shutil
import json
from tarfile import TarFile
from pathlib import Path
import pytest
from PIL import Image, ImageDraw
from aizynthfinder.utils import image
from aizynthfinder.chem import TreeMolecule, TemplatedRetroReaction
def new_image():
img = Image.new(mode="RGB", size=(300, 300), color="wh... | factory_hidden.image.width | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_image.py | test_image_factory | assert | complex_expr | 40 | import os
import shutil
import json
from tarfile import TarFile
from pathlib import Path
import pytest
from PIL import Image, ImageDraw
from aizynthfinder.utils import image
from aizynthfinder.chem import TreeMolecule, TemplatedRetroReaction
def new_image():
img = Image.new(mode="RGB", size=(300, 300), color="wh... | factory_hidden.image.height | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_dynamic_loading.py | test_incorrect_class | pytest.raises | complex_expr | 8 | import pytest
from aizynthfinder.utils.loading import load_dynamic_class
def test_incorrect_class():
bad_class = "ReactionTreee"
with pytest.raises( | ValueError, match=bad_class) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_dynamic_loading.py | test_incorrect_module | pytest.raises | complex_expr | 8 | import pytest
from aizynthfinder.utils.loading import load_dynamic_class
def test_incorrect_module():
bad_module = "aizynthfinder.rt."
with pytest.raises( | ValueError, match=bad_module) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_empty_store | assert | collection | 8 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_empty_store():
serializer = MoleculeSerializer()
assert serializer.store == | {} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_empty_collection | assert | collection | 10 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_empty_collection():
collection = StringCollection()
assert len(collection) == 0
assert collection.selection == | [] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_mcts_config.py | test_load_external_stock_incorrect_module | assert | collection | 21 | import pytest
from aizynthfinder.context.config import Configuration
from aizynthfinder.aizynthfinder import AiZynthFinder
def test_load_external_stock_incorrect_module(write_yaml, create_dummy_stock1):
stock_filename = create_dummy_stock1("hdf5")
filename = write_yaml(
{
"stock": {
... | [] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_serialize_node | assert | collection | 16 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_serialize_node(setup_mcts_search... | [] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_policy.py | test_get_actions | assert | collection | 42 | import pytest
import numpy as np
from aizynthfinder.chem import (
TreeMolecule,
SmilesBasedRetroReaction,
TemplatedRetroReaction,
)
from aizynthfinder.context.policy import (
TemplateBasedExpansionStrategy,
QuickKerasFilter,
ReactantsCountFilter,
)
from aizynthfinder.utils.exceptions import Rej... | [0.7] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_node.py | test_promising_child_of_root | assert | collection | 10 | def test_promising_child_of_root(setup_mcts_search):
root, _, _ = setup_mcts_search
root.expand()
child = root.promising_child()
view = root.children_view()
assert view["objects"][0] is child
assert root.children == | [child] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_add_single_item | assert | collection | 12 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_add_single_item():
collection = StringCollection()
collection.load("key1", "value1")
assert len(collection) == 1
assert collection.items == | ["key1"] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_select_single_item | assert | collection | 21 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_select_single_item():
collection = StringCollection()
collection.load("key1", "value1")
collection.selection = "key1"
assert collection.selection == ["key1"]
with pytest.raises(KeyError):
collection.se... | ["key2"] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_node.py | test_expand_root_node | assert | collection | 11 | def test_expand_root_node(setup_mcts_search):
root, _, _ = setup_mcts_search
root.expand()
view = root.children_view()
assert len(view["actions"]) == 3
assert view["priors"] == [0.7, 0.5, 0.3]
assert view["values"] == [0.7, 0.5, 0.3]
assert view["visitations"] == | [1, 1, 1] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_image.py | test_crop | assert | collection | 31 | import os
import shutil
import json
from tarfile import TarFile
from pathlib import Path
import pytest
from PIL import Image, ImageDraw
from aizynthfinder.utils import image
from aizynthfinder.chem import TreeMolecule, TemplatedRetroReaction
def new_image():
img = Image.new(mode="RGB", size=(300, 300), color="wh... | (0, 0, 0) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_create_root_node | assert | collection | 16 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | {node.mol} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_policy.py | test_get_actions | assert | collection | 30 | import pytest
import numpy as np
from aizynthfinder.chem import (
TreeMolecule,
SmilesBasedRetroReaction,
TemplatedRetroReaction,
)
from aizynthfinder.context.policy import (
TemplateBasedExpansionStrategy,
QuickKerasFilter,
ReactantsCountFilter,
)
from aizynthfinder.utils.exceptions import Rej... | [0.7, 0.2] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_policy.py | test_get_actions_two_policies | assert | collection | 42 | import pytest
import numpy as np
from aizynthfinder.chem import (
TreeMolecule,
SmilesBasedRetroReaction,
TemplatedRetroReaction,
)
from aizynthfinder.context.policy import (
TemplateBasedExpansionStrategy,
QuickKerasFilter,
ReactantsCountFilter,
)
from aizynthfinder.utils.exceptions import Rej... | [0.7, 0.7] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_create_graph | assert | collection | 8 | def test_create_graph(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
graph = tree.graph()
assert len(graph) == 3
assert list(graph.successors(nodes[0])) == | [nodes[1]] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_tree.py | test_create_graph | assert | collection | 9 | def test_create_graph(setup_complete_mcts_tree):
tree, nodes = setup_complete_mcts_tree
graph = tree.graph()
assert len(graph) == 3
assert list(graph.successors(nodes[0])) == [nodes[1]]
assert list(graph.successors(nodes[1])) == | [nodes[2]] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_create_root_node | assert | collection | 13 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_create_root_node(setup_star_root):
node = se... | {node.mol} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_external_tf_models.py | test_predict_tf_rest_model | assert | collection | 101 | import pytest
import numpy as np
import tensorflow as tf
import aizynthfinder.utils.models as models
from aizynthfinder.utils.models import (
ExternalModelViaREST,
ExternalModelViaGRPC,
SUPPORT_EXTERNAL_APIS,
)
def setup_rest_mock(mocker):
models.TF_SERVING_HOST = "localhost"
models.TF_SERVING_RES... | [0.0, 1.0] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_create_atom_tracking | assert | collection | 18 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_create_atom_tracking():
mol ... | {1: 0, 2: 1} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_inherit_atom_tracking | assert | collection | 19 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_inherit_atom_tracking():
mol... | {1: 0, 2: None} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_inherit_atom_tracking | assert | collection | 20 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_inherit_atom_tracking():
mol... | {1: None, 2: 1} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_inherit_atom_tracking_rdchiral | assert | collection | 25 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_inherit_atom_tracking_rdchiral()... | {1: None, 2: 0} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_inherit_atom_tracking_rdkit | assert | collection | 24 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_inherit_atom_tracking_rdkit():
... | {1: 1, 2: None} | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_add_tree_mol | assert | collection | 13 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_add_tree_mol():
serializer = MoleculeSerializer()
mol1 = TreeMolecule(parent=None, smiles="CCC", transform=1)
mol2 = TreeMolecule(smiles="CCO", parent=mol1)
... | [id(mol1), id_] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_policy.py | test_get_actions | assert | collection | 37 | import pytest
import numpy as np
from aizynthfinder.chem import (
TreeMolecule,
SmilesBasedRetroReaction,
TemplatedRetroReaction,
)
from aizynthfinder.context.policy import (
TemplateBasedExpansionStrategy,
QuickKerasFilter,
ReactantsCountFilter,
)
from aizynthfinder.utils.exceptions import Rej... | [0.7, 0.2, 0.1] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_node.py | test_expand_root_node | assert | collection | 9 | def test_expand_root_node(setup_mcts_search):
root, _, _ = setup_mcts_search
root.expand()
view = root.children_view()
assert len(view["actions"]) == 3
assert view["priors"] == | [0.7, 0.5, 0.3] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/test_expander.py | test_expander_top1 | assert | collection | 13 | from aizynthfinder.aizynthfinder import AiZynthExpander
def test_expander_top1(get_one_step_expansion, setup_policies):
expander = AiZynthExpander()
setup_policies(get_one_step_expansion, config=expander.config)
smi = "CCCCOc1ccc(CC(=O)N(C)O)cc1"
reactions = expander.do_expansion(smi, return_n=1)
... | ["CCCCOc1ccc(CC(=O)Cl)cc1", "CNO"] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_search.py | test_one_iteration | assert | collection | 32 | import random
import pytest
from aizynthfinder.search.breadth_first.search_tree import SearchTree
def test_one_iteration(default_config, setup_policies, setup_stock):
root_smi = "CN1CCC(C(=O)c2cccc(NC(=O)c3ccc(F)cc3)c2F)CC1"
child1_smi = ["CN1CCC(Cl)CC1", "N#Cc1cccc(NC(=O)c2ccc(F)cc2)c1F", "O"]
child2_sm... | [root_smi] + child1_smi + child2_smi | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/test_expander.py | test_expander_filter | assert | collection | 16 | from aizynthfinder.aizynthfinder import AiZynthExpander
def test_expander_filter(get_one_step_expansion, setup_policies):
def filter_func(reaction):
return "CNO" not in [mol.smiles for mol in reaction.reactants[0]]
expander = AiZynthExpander()
setup_policies(get_one_step_expansion, config=expander... | ["CCCCBr", "CN(O)C(=O)Cc1ccc(O)cc1"] | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_search.py | test_routes | assert | collection | 36 | import random
import pytest
from aizynthfinder.search.breadth_first.search_tree import SearchTree
def test_routes(default_config, setup_policies, setup_stock):
random.seed(666)
root_smi = "CN1CCC(C(=O)c2cccc(NC(=O)c3ccc(F)cc3)c2F)CC1"
child1_smi = ["O", "CN1CCC(Cl)CC1", "N#Cc1cccc(NC(=O)c2ccc(F)cc2)c1F"]... | [root_smi] + child1_smi + grandchild_smi | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_add_single_mol | assert | func_call | 11 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_add_single_mol():
serializer = MoleculeSerializer()
mol = Molecule(smiles="CCC")
id_ = serializer[mol]
assert id_ == | id(mol) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_serialize_deserialize_state | assert | func_call | 16 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_serialize_deserialize_state(defa... | id(mol) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_add_tree_mol | assert | func_call | 12 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_add_tree_mol():
serializer = MoleculeSerializer()
mol1 = TreeMolecule(parent=None, smiles="CCC", transform=1)
mol2 = TreeMolecule(smiles="CCO", parent=mol1)
... | id(mol2) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_chaining | assert | func_call | 17 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_chaining():
serializer = MoleculeSerializer()
mol1 = TreeMolecule(parent=None, smiles="CCC", transform=1)
mol2 = TreeMolecule(smiles="CCO", parent=mol1)
... | id(mol1) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_deserialize_node | assert | func_call | 32 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_deserialize_node(setup_mcts_sear... | str(root.state) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/mcts/test_serialization.py | test_deserialize_node | assert | func_call | 33 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import TreeMolecule
from aizynthfinder.search.mcts import MctsState
from aizynthfinder.search.mcts import MctsNode
from aizynthfinder.search.mcts import MctsSearchTree
def test_deserialize_node(setup_mcts_sear... | str(child.state) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_save_load_datafile_roundtrip | assert | func_call | 49 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | data2.a.to_list() | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_save_load_datafile_roundtrip | assert | func_call | 50 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | data2.b.to_list() | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_image.py | test_visjs_page | assert | func_call | 37 | import os
import shutil
import json
from tarfile import TarFile
from pathlib import Path
import pytest
from PIL import Image, ImageDraw
from aizynthfinder.utils import image
from aizynthfinder.chem import TreeMolecule, TemplatedRetroReaction
def new_image():
img = Image.new(mode="RGB", size=(300, 300), color="wh... | tarobj.getnames() | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_serialization_deserialization | assert | func_call | 29 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | len(root.children) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_cost.py | test_retrostar_cost | pytest.approx | func_call | 14 | import numpy as np
import pytest
from aizynthfinder.context.cost import MoleculeCost
from aizynthfinder.search.retrostar.cost import RetroStarCost
from aizynthfinder.chem import Molecule
def test_retrostar_cost(setup_mocked_model):
mol = Molecule(smiles="CCCC")
cost = RetroStarCost(model_path="dummy", finge... | cost(mol), abs=0.001) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar.py | test_serialization_deserialization | assert | func_call | 45 | import numpy as np
from aizynthfinder.search.retrostar.search_tree import SearchTree
from aizynthfinder.chem.serialization import MoleculeSerializer
def test_serialization_deserialization(
mocker, setup_search_tree, tmpdir, default_config
):
tree = setup_search_tree
tree.one_iteration()
mocked_json_d... | len(tree.root.children) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_save_load_datafile_roundtrip | assert | func_call | 48 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | data2.columns.to_list() | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/retrostar/test_retrostar_nodes.py | test_converstion_to_reaction_tree | assert | func_call | 33 | import numpy as np
import networkx as nx
from aizynthfinder.search.retrostar.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.search.andor_trees import ReactionTreeFromAndOrTrace
def test_converstion_to_reaction_tree(
setup_star_roo... | reaction.reaction_smiles() | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/breadth_first/test_nodes.py | test_create_stub | assert | func_call | 25 | import pytest
from aizynthfinder.search.breadth_first.nodes import MoleculeNode
from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
def setup_root(default_config):
def wrapper(smiles):
return MoleculeNode.create_root(smiles, config=default_config)
return wrapper
def... | list(reaction.reactants[0]) | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_mol.py | test_create_with_mol | assert | string_literal | 12 | import pytest
from rdkit import Chem
from aizynthfinder.chem import MoleculeException, Molecule
def test_create_with_mol():
rd_mol = Chem.MolFromSmiles("O")
mol = Molecule(rd_mol=rd_mol)
assert mol.smiles == | "O" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_smiles_based_retroreaction | assert | string_literal | 21 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_smiles_based_retroreaction():
... | "CN" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_retro_reaction | assert | string_literal | 20 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_retro_reaction(get_action):
... | "CNO" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_deserialize_single_mol | assert | string_literal | 9 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_deserialize_single_mol():
store = {123: {"smiles": "CCC", "class": "Molecule"}}
deserializer = MoleculeDeserializer(store)
assert deserializer[123].smiles =... | "CCC" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_deserialize_tree_mols | assert | string_literal | 19 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_deserialize_tree_mols():
store = {
123: {
"smiles": "CCC",
"class": "TreeMolecule",
"parent": None,
"transform... | "CCO" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_select_single_collection | assert | string_literal | 13 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_select_single_collection():
collection = SingleStringCollection()
collection.load("key1", "value1")
collection.load("key2", "value2")
collection.selection = "key1"
assert collection.selection == | "key1" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_select_single_collection | assert | string_literal | 17 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_select_single_collection():
collection = SingleStringCollection()
collection.load("key1", "value1")
collection.load("key2", "value2")
collection.selection = "key1"
assert collection.selection == "key1"
col... | "key2" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_split_file_even | assert | string_literal | 44 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | "a\nb" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_split_file_even | assert | string_literal | 45 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | "c\nd" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_split_file_even | assert | string_literal | 46 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | "e\nf" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_split_file_odd | assert | string_literal | 45 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | "d\ne" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_split_file_odd | assert | string_literal | 46 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | "f\ng" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_get_item | assert | string_literal | 10 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_get_item():
collection = StringCollection()
collection.load("key1", "value1")
assert collection["key1"] == | "value1" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_smiles_based_retroreaction | assert | string_literal | 20 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_smiles_based_retroreaction():
... | "CC(=O)O" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_split_file_odd | assert | string_literal | 44 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | "a\nb\nc" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_reaction.py | test_fwd_reaction | assert | string_literal | 26 | from aizynthfinder.chem import (
Molecule,
UniqueMolecule,
TreeMolecule,
Reaction,
TemplatedRetroReaction,
FixedRetroReaction,
SmilesBasedRetroReaction,
hash_reactions,
MoleculeException,
)
from aizynthfinder.reactiontree import ReactionTree
def test_fwd_reaction():
mol1 = Molec... | "CNC(C)=O" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_policy.py | test_load_templated_expansion_policy | assert_* | string_literal | 21 | import pytest
import numpy as np
from aizynthfinder.chem import (
TreeMolecule,
SmilesBasedRetroReaction,
TemplatedRetroReaction,
)
from aizynthfinder.context.policy import (
TemplateBasedExpansionStrategy,
QuickKerasFilter,
ReactantsCountFilter,
)
from aizynthfinder.utils.exceptions import Rej... | "dummy.hdf5") | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_mol.py | test_sanitize | assert | string_literal | 18 | import pytest
from rdkit import Chem
from aizynthfinder.chem import MoleculeException, Molecule
def test_sanitize():
mol = Molecule(smiles="O", sanitize=True)
assert Chem.MolToSmiles(mol.rd_mol) == "O"
mol = Molecule(smiles="c1ccccc1(C)(C)")
with pytest.raises(MoleculeException):
mol.saniti... | "CC1(C)CCCCC1" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_dynamic_loading.py | test_simple | assert | string_literal | 9 | import pytest
from aizynthfinder.utils.loading import load_dynamic_class
def test_simple():
cls = load_dynamic_class("aizynthfinder.reactiontree.ReactionTree")
assert cls.__name__ == | "ReactionTree" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/utils/test_file_utils.py | test_start_processes | assert | string_literal | 50 | import os
import gzip
import json
import pytest
import pandas as pd
from aizynthfinder.utils.files import (
cat_datafiles,
split_file,
start_processes,
read_datafile,
save_datafile,
)
def create_dummy_file(tmpdir, mocker):
patched_tempfile = mocker.patch("aizynthfinder.utils.files.tempfile.mk... | f"dummy-{index}\n" | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/chem/test_serialization.py | test_deserialize_tree_mols | assert | none_literal | 20 | from aizynthfinder.chem.serialization import MoleculeSerializer, MoleculeDeserializer
from aizynthfinder.chem import Molecule, TreeMolecule
def test_deserialize_tree_mols():
store = {
123: {
"smiles": "CCC",
"class": "TreeMolecule",
"parent": None,
"transform... | None | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
MolecularAI/aizynthfinder | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | train | train | tests/context/test_collection.py | test_empty_single_collection | assert | none_literal | 10 | import pytest
from aizynthfinder.context.collection import ContextCollection
def test_empty_single_collection():
collection = SingleStringCollection()
assert len(collection) == 0
assert collection.selection is | None | 9e44989213c11f1bb647a00b8756e0c76a8f4b52 | 21 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.