def testGetObjectChildren(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) obj = uut.get_object(others[0].get_uid()) self.assertEqual(obj, others[0])
def testGetObjectSelfWithChilds(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) obj = uut.get_object(uut.get_uid()) self.assertEqual(uut, obj)
def testGetObjectMultipleLevels(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 obj = uut.get_object(others[-1].get_uid()) self.assertEqual(obj, others[-1])
def testGetObjectDoesntExist(self): uut = MtpObject(self.default_data, self.get_default_info()) obj = uut.get_object(uut.get_uid() + 1) self.assertIsNone(obj)
def testGetObjectSelfAlone(self): uut = MtpObject(self.default_data, self.get_default_info()) obj = uut.get_object(uut.get_uid()) self.assertEqual(uut, obj)