l.s.o.OrderingCheck : class documentation

Part of lp.services.orderingcheck View In Hierarchy

Helper class: verify that items are in an expected order.

Use this if to verify that a series of items you are iterating over is in some expected order. Any items that are not ordered the way you expect are reported to a customizable failure handler; it raises an error by default.

Method __init__ Define an ordering. Parameters are as for sorted().
Method check Verify that item comes after the previous item, if any.
Method fail Report that item is not in its proper place.
def __init__(self, **kwargs):
Define an ordering. Parameters are as for sorted().
def check(self, item):
Verify that item comes after the previous item, if any.

Call this with each of the items in the sequence as you process them. If any of the items is not at its right place in the sequence, this will call fail with that item.

def fail(self, item):
Report that item is not in its proper place.

Default action is to raise an assertion error.

API Documentation for Launchpad, generated by pydoctor at 2019-08-18 00:00:05.