def test_iter_datasets_types(self): dataset = Particles('M1') dataset.add([Particle(), Particle()]) c = CUDS() c.add([dataset]) for ps in c.iter(item_type=CUBA.PARTICLES): self.assertIsInstance(ps, Particles) self.assertIn(ps, [dataset])
def test_iter_with_uid(self): c = CUDS() c.add([self.named_cuds_1]) c.add([self.named_cuds_2]) component_list = [] for component in c.iter(uids=[self.named_cuds_1.uid]): component_list.append(component) self.assertTrue(len(component_list), 1) self.assertEqual(component_list[0].uid, self.named_cuds_1.uid)
def test_iter_with_component(self): c = CUDS() c.add([self.named_cuds_1]) c.add([self.named_cuds_2]) component_list = [] for component in c.iter(item_type=CUBA.BOX): component_list.append(component) self.assertTrue(len(component_list), 2) for cmp in component_list: self.assertIn(cmp, [self.named_cuds_1, self.named_cuds_2])
def test_iter_datasets_dimention(self): ps1 = Particles('M1') ps2 = Particles('M2') ps1.add([Particle(), Particle()]) ps2.add([Particle(), Particle()]) c = CUDS() c.add([ps1]) c.add([ps2]) cuds_list = [] for component in c.iter(item_type=CUBA.PARTICLES): cuds_list.append(component) self.assertTrue(len(cuds_list), 2)