def test_group_entries_by_structure(self): entries = loadfn(os.path.join(PymatgenTest.TEST_FILES_DIR, "TiO2_entries.json")) groups = group_entries_by_structure(entries) self.assertEqual(sorted(len(g) for g in groups), [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4]) self.assertLess(len(groups), len(entries)) # Make sure no entries are left behind self.assertEqual(sum(len(g) for g in groups), len(entries))
def test_group_entries_by_structure(self): entries = loadfn(str(test_dir / "TiO2_entries.json")) groups = group_entries_by_structure(entries) self.assertEqual(sorted([len(g) for g in groups]), [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4]) self.assertLess(len(groups), len(entries)) # Make sure no entries are left behind self.assertEqual(sum([len(g) for g in groups]), len(entries))
def test_group_entries_by_structure(self): with open(os.path.join(test_dir, "TiO2_entries.json"), "r") as f: entries = json.load(f, cls=MontyDecoder) groups = group_entries_by_structure(entries) self.assertEqual(sorted([len(g) for g in groups]), [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 4]) self.assertLess(len(groups), len(entries)) #Make sure no entries are left behind self.assertEqual(sum([len(g) for g in groups]), len(entries))