Example #1
0
    def represented(self, indent=0, annotate=True):
        """
        Return a representation of the node
        """

        s = u' ' * indent + self.text.strip()

        if annotate:
            s = strings.ljust(s, self.feature.max_length + 1) + \
                u'# ' + unicode(self.described_at)

        return s
Example #2
0
    def represented(self, indent=0, annotate=True):
        """
        Reresent a tagged block
        """

        s = u' ' * indent + u'{keyword}: {name}'.format(keyword=self.keyword,
                                                        name=self.name)
        if annotate:
            s = strings.ljust(s, self.feature.max_length + 1) + \
                u'# ' + unicode(self.described_at)

        return s
Example #3
0
    def represent_line(self, n, indent=2, annotate=True):
        """
        Represent the nth line in the description
        """

        line = self.lines[n]
        s = u' ' * indent + line

        if annotate:
            s = strings.ljust(s, self.feature.max_length + 1) + \
                u'# {file}:{line}'.format(
                    file=self.described_at.file,
                    line=self.description_at[n])

        return s
Example #4
0
    def represented(self, indent=4, annotate=True):
        """
        Override the version of represented provided by the parser node
        to add the additional capability of annotating with the step
        definition
        """

        s = super(Step, self).represented(
            indent=indent,
            # steps without definitions return their feature file
            annotate=annotate and not self.has_definition)

        # steps with definitions return their step definition
        if annotate:
            if self.has_definition:
                s = strings.ljust(s, self.feature.max_length + 1) + \
                    u'# ' + unicode(self.defined_at)
            else:
                s += u" (undefined)"

        return s