def test_group_molecules(self):
     mm = MoleculeMatcher(tolerance=0.001)
     with open(os.path.join(test_dir, "mol_list.txt")) as f:
         filename_list = [line.strip() for line in f.readlines()]
     mol_list = [read_mol(os.path.join(test_dir, f)) for f in filename_list]
     mol_groups = mm.group_molecules(mol_list)
     filename_groups = [[filename_list[mol_list.index(m)] for m in g]
                        for g in mol_groups]
     with open(os.path.join(test_dir, "grouped_mol_list.txt")) as f:
         grouped_text = f.read().strip()
     self.assertEqual(str(filename_groups), grouped_text)
 def test_group_molecules(self):
     mm = MoleculeMatcher(tolerance=0.001)
     with open(os.path.join(test_dir, "mol_list.txt")) as f:
         filename_list = [line.strip() for line in f.readlines()]
     mol_list = [Molecule.from_file(os.path.join(test_dir, f))
                 for f in filename_list]
     mol_groups = mm.group_molecules(mol_list)
     filename_groups = [[filename_list[mol_list.index(m)] for m in g]
                        for g in mol_groups]
     with open(os.path.join(test_dir, "grouped_mol_list.txt")) as f:
         grouped_text = f.read().strip()
     self.assertEqual(str(filename_groups), grouped_text)
 def test_group_molecules(self):
     mm = MoleculeMatcher(tolerance=0.001)
     filename_list = None
     with open(os.path.join(test_dir, "mol_list.txt")) as f:
         filename_list = [line.strip() for line in f.readlines()]
     mol_list = [BabelMolAdaptor.from_file(os.path.join(test_dir, f)).pymatgen_mol\
                 for f in filename_list]
     mol_groups = mm.group_molecules(mol_list)
     filename_groups = [[filename_list[mol_list.index(m)] for m in g] for g \
                        in mol_groups]
     grouped_text = None
     with open(os.path.join(test_dir, "grouped_mol_list.txt")) as f:
         grouped_text = f.read().strip()
     self.assertEqual(str(filename_groups), grouped_text)