def testGetObjectsWithMultipleChildes(self): others = [ MtpObject(self.default_data, self.get_default_info()), MtpObject(self.default_data, self.get_default_info()), MtpObject(self.default_data, self.get_default_info()) ] uut = MtpObject(self.default_data, self.get_default_info()) for obj in others: uut.add_object(obj) objs = uut.get_objects() self.assertEqual(len(objs), len(set(objs))) self.assertEqual(len(objs), len(others)) self.assertEqual(set(objs), set(others))
def testGetObjectsMultipleLevels(self): others = [ MtpObject(self.default_data, self.get_default_info()), MtpObject(self.default_data, self.get_default_info()), MtpObject(self.default_data, self.get_default_info()) ] uut = MtpObject(self.default_data, self.get_default_info()) cur = uut for obj in others: cur.add_object(obj) cur = obj objs = uut.get_objects() self.assertEqual(len(objs), len(set(objs))) self.assertEqual(len(objs), len(others)) self.assertEqual(set(objs), set(others))
def testGetObjectsEmpty(self): uut = MtpObject(self.default_data, self.get_default_info()) self.assertEqual(uut.get_objects(), [])