def test_class(self): # Tests entire class as single working unit sm = StructureMatcher() # Test group_structures and find_indices out = sm.group_structures(self.struct_list) self.assertEqual(sm.find_indexes(self.struct_list, out), [0, 0, 0, 1, 2, 3, 4, 0, 5, 6, 7, 8, 8, 9, 9, 10])
class RemoveDuplicatesFilterTest(unittest.TestCase): def setUp(self): with open(os.path.join(test_dir, "TiO2_entries.json"), "rb") as fp: entries = json.load(fp, cls=PMGJSONDecoder) self._struct_list = [e.structure for e in entries] self._sm = StructureMatcher() def test_filter(self): transmuter = StandardTransmuter.from_structures(self._struct_list) fil = RemoveDuplicatesFilter() transmuter.apply_filter(fil) out = self._sm.group_structures(transmuter.transformed_structures) self.assertEqual( self._sm.find_indexes(transmuter.transformed_structures, out), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ) def test_to_from_dict(self): fil = RemoveDuplicatesFilter() d = fil.to_dict self.assertIsInstance(RemoveDuplicatesFilter().from_dict(d), RemoveDuplicatesFilter)
class RemoveDuplicatesFilterTest(unittest.TestCase): def setUp(self): with open(os.path.join(test_dir, "TiO2_entries.json"), 'r') as fp: entries = json.load(fp, cls=PMGJSONDecoder) self._struct_list = [e.structure for e in entries] self._sm = StructureMatcher() def test_filter(self): transmuter = StandardTransmuter.from_structures(self._struct_list) fil = RemoveDuplicatesFilter() transmuter.apply_filter(fil) out = self._sm.group_structures(transmuter.transformed_structures) self.assertEqual( self._sm.find_indexes(transmuter.transformed_structures, out), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) def test_to_from_dict(self): fil = RemoveDuplicatesFilter() d = fil.to_dict self.assertIsInstance(RemoveDuplicatesFilter().from_dict(d), RemoveDuplicatesFilter)