def test_atoms(self): """Asserts whether the atom space is correct or not.""" test_molecule = Mol("C", "ClCC(Cl)(Cl)Cl") with self.subTest(): self.assertEqual(test_molecule.get_atoms(), ["Cl", "C"]) with self.subTest(): self.assertEqual(test_molecule.get_atoms(), ["C", "Cl"])
def test_add_back(self): """Tests the functionality of adding an atom to the back of a molecule.""" test_molecule = Mol() test_molecule.set_start_molecule("C") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") test_molecule.add_atom("", "C") self.assertEqual(test_molecule.start, "CC")
def test_atoms(self): """Asserts whether the atom space is correct or not.""" test_molecule = Mol() test_molecule.set_start_molecule("C") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") atom_set = set(test_molecule.get_atoms()) self.assertEqual(atom_set, {"Cl", "C"})
def test_action_space(): """Tests the format of the action space.""" test_molecule = Mol() test_molecule.set_start_molecule("C") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") env = gym.make("gym_molecule:molecule-v0", mol=test_molecule, goal=100) assert env.action_space == spaces.Discrete(6)
def test_init_goal(): """Tests whether the env correctly sets the goal. """ test_molecule = Mol() test_molecule.set_start_molecule("C") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") env = gym.make("gym_molecule:molecule-v0", mol=test_molecule, goal=100) assert env.target_molecule == "ClCC(Cl)(Cl)Cl"
def test_main(): """Tests that an iteration of the environment-agent interaction is correct.""" test_molecule = Mol() test_molecule.set_start_molecule("C") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") env = gym.make("gym_molecule:molecule-v0", mol=test_molecule, goal=100) agent = MoleculeAgent(env.observation_space, env.action_space) state = env.reset() reward = 0 done = False action = agent.act(state, reward, done) assert env.step(action) == (np.array(env.state), 10, False, env.molecule.modifications)
def test_validity(self): test_molecule = Mol("C", "ClCC(Cl)(Cl)Cl") self.assertEqual()
def test_history(self): test_molecule = Mol("C", "ClCC(Cl)(Cl)Cl") self.assertEqual()
def test_remove(self): """Tests the functionality of removing an atom from the molecule.""" test_molecule = Mol("C", "ClCC(Cl)(Cl)Cl") self.assertEqual()
def test_add_back(self): """Tests the functionality of adding an atom to the back of a molecule.""" test_molecule = Mol("C", "ClCC(Cl)(Cl)Cl") self.assertEqual()
def test_bonds(self): """Asserts whether the bond space is correct or not.""" test_molecule = Mol("C", "ClCC(Cl)(Cl)Cl") self.assertEqual()
def test_validity(self): test_molecule = Mol() test_molecule.set_start_molecule("CX") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") self.assertEqual(test_molecule.is_valid(test_molecule.start), False)
def test_bonds(self): """Asserts whether the bond space is correct or not.""" test_molecule = Mol() test_molecule.set_start_molecule("C") test_molecule.set_target_molecule("ClCC(Cl)(Cl)Cl") self.assertEqual(test_molecule.get_bonds(), [1.0])