<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">"""
Collection of assertion functions used for the steps.
"""

class Almost:
    """ Compares a float value with a certain jitter.
    """
    def __init__(self, value, offset=0.00001):
        self.value = value
        self.offset = offset

    def __eq__(self, other):
        return abs(other - self.value) &lt; self.offset

class Bbox:
    """ Comparator for bounding boxes.
    """
    def __init__(self, bbox_string):
        self.coord = [float(x) for x in bbox_string.split(',')]

    def __contains__(self, item):
        if isinstance(item, str):
            item = item.split(',')
        item = list(map(float, item))

        if len(item) == 2:
            return self.coord[0] &lt;= item[0] &lt;= self.coord[2] \
                   and self.coord[1] &lt;= item[1] &lt;= self.coord[3]

        if len(item) == 4:
            return item[0] &gt;= self.coord[0] and item[1] &lt;= self.coord[1] \
                   and item[2] &gt;= self.coord[2] and item[3] &lt;= self.coord[3]

        raise ValueError("Not a coordinate or bbox.")

    def __str__(self):
        return str(self.coord)
</pre></body></html>