def test_attach_detach(self): parts = list(SystemPart.get_active(self.database)) self.assertEqual(len(parts), 1) parts[0].detach() self.assertEqual(len(list(SystemPart.get_active(self.database))), 0) parts[0].attach() self.assertEqual(len(list(SystemPart.get_active(self.database))), 1)
def test_attach_detach(self): parts = list(SystemPart.get_active(self.database)) self.assertEqual(len(parts), 2) for p in parts: p.detach() self.assertEqual(len(list(SystemPart.get_active(self.database))), 0) for p in parts: p.attach() self.assertEqual(len(list(SystemPart.get_active(self.database))), 2)
def test_drop(self): parts = list(SystemPart.get_active(self.database)) parts[0].drop() self.assertEqual(len(list(SystemPart.get_active(self.database))), 0)
def test_get_active(self): parts = list(SystemPart.get_active(self.database)) self.assertEqual(len(parts), 2) parts[0].detach() parts = list(SystemPart.get_active(self.database)) self.assertEqual(len(parts), 1)
def test_drop(self): parts = list(SystemPart.get_active(self.database)) for p in parts: p.drop() self.assertEqual(len(list(SystemPart.get_active(self.database))), 0)
def test_get_active(self): parts = list(SystemPart.get_active(self.database)) self.assertEqual(len(parts), 2) parts[0].detach() self.assertEqual(len(list(SystemPart.get_active(self.database))), 1)