def _validate_element_type()

in function_app/src/components/doc_intelligence.py [0:0]


    def _validate_element_type(self, element_info: ElementInfo):
        """
        Validates that the Document element contained by the ElementInfo object
        is of the expected type.

        :param element_info: Information about the Document element.
        :type element_info: ElementInfo
        :raises ValueError: If the element of the ElementInfo object is not of
            the expected type.
        """
        if not self.expected_elements:
            raise ValueError("expected_element has not been set for this processor.")

        if not any(
            isinstance(element_info.element, expected_element)
            for expected_element in self.expected_elements
        ):
            raise ValueError(
                f"Element is incorrect type - {type(element_info.element)}. It should be one of `{self.expected_elements}` types."
            )