def test_get_path_difference__new_is_subset(self): """ Test the new path being a proper subset. """ objects = [[i] for i in range(4)] old_seq = objects new_seq = objects[:2] # Then no elements are new. expected = [] actual = datamodel.get_path_difference(new_seq, old_seq) self.assertEqual(actual, expected)
def test_get_path_difference__new_is_superset(self): """ Test the new path being a proper superset. """ objs = [[i] for i in range(4)] old_seq = objs[:2] new_seq = objs expected = [ (3, objs[2]), (4, objs[3]), ] actual = datamodel.get_path_difference(new_seq, old_seq) self.assertEqual(actual, expected)
def test_get_path_difference(self): """ Test the typical case. """ obj1, obj2, obj3, obj4, obj5 = ([i] for i in range(5)) old_seq = [obj1, obj2, obj3] new_seq = [obj1, obj2, obj4, obj5] expected = [ (3, obj4), (4, obj5), ] actual = datamodel.get_path_difference(new_seq, old_seq) self.assertEqual(actual, expected)