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j '  'P$a ( `D$Na L?u80e J,K˷NI'0eݷ(NI'؀ 2ipIIKp`:O'`ʤxB8Ѥx Ѥx $ $P6 :vRNb 'p,>NB 'P]-->P T+*^h& p '‰a ‰ (ĵt#u33;Nt̵'ޯ; [3W ~]0KH1q@8]O2]3*̧7# *p>us p _6]/}-4|t'|Smx= DoʾM×M_8!)6lq':l7!|4} '\ne t!=hnLn (~Dn\+‰_4k)0e@OhZ`F `.m1} 'vp{F`ON7Srx 'D˸nV`><;yMx!IS钦OM)Ե٥x 'DSD6bS8!" ODz#R >S8!7ّxEh0m$MIPHi$IvS8IN$I p$O8I,sk&I)$IN$Hi$I^Ah.p$MIN$IR8I·N "IF9Ah0m$MIN$IR8IN$I 3jIU;kO$ɳN$+ q.x* tEXtComment

Viewing File: /opt/cloudlinux/venv/lib/python3.11/site-packages/tap/line.py

try:
    import yaml

    LOAD_YAML = True
except ImportError:  # pragma: no cover
    LOAD_YAML = False


class Line:
    """Base type for TAP data.

    TAP is a line based protocol. Thus, the most primitive type is a line.
    """

    @property
    def category(self):
        raise NotImplementedError


class Result(Line):
    """Information about an individual test line."""

    def __init__(
        self,
        ok,
        number=None,
        description="",
        directive=None,
        diagnostics=None,
        raw_yaml_block=None,
    ):
        self._ok = ok
        if number:
            self._number = int(number)
        else:
            # The number may be an empty string so explicitly set to None.
            self._number = None
        self._description = description
        self.directive = directive
        self.diagnostics = diagnostics
        self._yaml_block = raw_yaml_block

    @property
    def category(self):
        """:returns: ``test``"""
        return "test"

    @property
    def ok(self):
        """Get the ok status.

        :rtype: bool
        """
        return self._ok

    @property
    def number(self):
        """Get the test number.

        :rtype: int
        """
        return self._number

    @property
    def description(self):
        """Get the description."""
        return self._description

    @property
    def skip(self):
        """Check if this test was skipped.

        :rtype: bool
        """
        return self.directive.skip

    @property
    def todo(self):
        """Check if this test was a TODO.

        :rtype: bool
        """
        return self.directive.todo

    @property
    def yaml_block(self):
        """Lazy load a yaml_block.

        If yaml support is not available,
        there is an error in parsing the yaml block,
        or no yaml is associated with this result,
        ``None`` will be returned.

        :rtype: dict
        """
        if LOAD_YAML and self._yaml_block is not None:
            try:
                yaml_dict = yaml.load(self._yaml_block, Loader=yaml.SafeLoader)
                return yaml_dict
            except yaml.error.YAMLError:
                print("Error parsing yaml block. Check formatting.")
        return None

    def __str__(self):
        is_not = ""
        if not self.ok:
            is_not = "not "
        directive = ""
        if self.directive is not None and self.directive.text:
            directive = f" # {self.directive.text}"
        diagnostics = ""
        if self.diagnostics is not None:
            diagnostics = "\n" + self.diagnostics.rstrip()
        return f"{is_not}ok {self.number} {self.description}{directive}{diagnostics}"


class Plan(Line):
    """A plan line to indicate how many tests to expect."""

    def __init__(self, expected_tests, directive=None):
        self._expected_tests = expected_tests
        self.directive = directive

    @property
    def category(self):
        """:returns: ``plan``"""
        return "plan"

    @property
    def expected_tests(self):
        """Get the number of expected tests.

        :rtype: int
        """
        return self._expected_tests

    @property
    def skip(self):
        """Check if this plan should skip the file.

        :rtype: bool
        """
        return self.directive.skip


class Diagnostic(Line):
    """A diagnostic line (i.e. anything starting with a hash)."""

    def __init__(self, text):
        self._text = text

    @property
    def category(self):
        """:returns: ``diagnostic``"""
        return "diagnostic"

    @property
    def text(self):
        """Get the text."""
        return self._text


class Bail(Line):
    """A bail out line (i.e. anything starting with 'Bail out!')."""

    def __init__(self, reason):
        self._reason = reason

    @property
    def category(self):
        """:returns: ``bail``"""
        return "bail"

    @property
    def reason(self):
        """Get the reason."""
        return self._reason


class Version(Line):
    """A version line (i.e. of the form 'TAP version 13')."""

    def __init__(self, version):
        self._version = version

    @property
    def category(self):
        """:returns: ``version``"""
        return "version"

    @property
    def version(self):
        """Get the version number.

        :rtype: int
        """
        return self._version


class Unknown(Line):
    """A line that represents something that is not a known TAP line.

    This exists for the purpose of a Null Object pattern.
    """

    @property
    def category(self):
        """:returns: ``unknown``"""
        return "unknown"
Back to Directory=ceiIENDB`