Ensures :attr:`subject` has length *length* (if given), length at least *min* (if given), and length at most
        *max* (if given).

def has_length(self, length=None, min=None, max=None):
        """
        Ensures :attr:`subject` has length *length* (if given), length at least *min* (if given), and length at most
        *max* (if given).
        """
        unittest_case.assertFalse(length is None and min is None and max is None)
        my_length = len(self._subject)
        if length is not None:
            try:
                unittest_case.assertTrue(my_length == length)
            except self._catch as err:
                raise self._error_factory(_format("Expected {} to have length {}", self._subject, length))
        if min is not None:
            try:
                unittest_case.assertTrue(my_length >= min)
            except self._catch as err:
                raise self._error_factory(_format("Expected {} to have length at least {}", self._subject, min))
        if max is not None:
            try:
                unittest_case.assertTrue(my_length <= max)
            except self._catch as err:
                raise self._error_factory(_format("Expected {} to have length at most {}", self._subject, max))
        return ChainInspector(self._subject)