Example #1
0
    def represented(self):
        length = self.max_length + 1

        filename = self.described_at.file
        line = self.described_at.line
        head = strings.rfill(self.get_head(), length, append=u"# %s:%d\n" % (filename, line))
        for description, line in zip(self.description.splitlines(), self.described_at.description_at):
            head += strings.rfill(u"  %s" % description, length, append=u"# %s:%d\n" % (filename, line))

        return head
Example #2
0
    def represented(self):
        length = self.max_length + 1

        filename = self.described_at.file
        line = self.described_at.line
        head = strings.rfill(self.get_head(), length, append=u"# %s:%d\n" % (filename, line))
        for description, line in zip(self.description.splitlines(), self.described_at.description_at):
            head += strings.rfill(u"  %s" % description, length, append=u"# %s:%d\n" % (filename, line))

        return head
Example #3
0
    def represent_string(self, string):
        where = self.described_at

        if FeatureLoader.step_number:
          head = ' ' * self.indentation + '%3d'%where.idx + '. ' + string
        else:
          head = ' ' * self.indentation + string

        if self.defined_at:
            where = self.defined_at

        head = strings.split_string_with_lines(head, ' ' * (self.indentation + 8))
        if FeatureLoader.show_filenames:
          return strings.rfill(head[0], self.scenario.feature.max_length + 1, append=u'# %s:%d\n' % (where.file, where.line)), head[1]
        return strings.rfill(head[0], self.scenario.feature.max_length + 1, append=u'\n'), head[1]
Example #4
0
    def represent_string(self, string):
        head = ' ' * self.indentation + string
        where = self.described_at

        if self.defined_at:
            where = self.defined_at
        return strings.rfill(head, self.parent.feature.max_length + 1, append=u'# %s:%d\n' % (where.file, where.line))
Example #5
0
    def represented(self):
        head = self._get_head()

        return strings.rfill(head,
                             self.feature.max_length + 1,
                             append=u'# %s:%d\n' %
                             (self.described_at.file, self.described_at.line))
Example #6
0
    def represented(self):
        make_prefix = lambda x: u"%s%s: " % (u' ' * self.indentation, x)
        if self.outlines:
            prefix = make_prefix(self.language.first_of_scenario_outline)
        else:
            prefix = make_prefix(self.language.first_of_scenario)

        head_parts = []
        if self.tags:
            tags = ['@%s' % t for t in self.tags]
            head_parts.append(u' ' * self.indentation)
            head_parts.append(' '.join(tags) + '\n')

        head_parts.append(prefix + self.name)

        head = ''.join(head_parts)
        appendix = ''
        if self.described_at:
            fmt = (self.described_at.file, self.described_at.line)
            appendix = u'# %s:%d\n' % fmt

        max_length = self.max_length
        if self.feature:
            max_length = self.feature.max_length

        return strings.rfill(
            head, max_length + 1,
            append=appendix)
Example #7
0
    def represented(self):
        make_prefix = lambda x: u"%s%s: " % (u' ' * self.indentation, x)
        if self.outlines:
            prefix = make_prefix(self.language.first_of_scenario_outline)
        else:
            prefix = make_prefix(self.language.first_of_scenario)

        head_parts = []
        if self.tags:
            tags = ['@%s' % t for t in self.tags]
            head_parts.append(u' ' * self.indentation)
            head_parts.append(' '.join(tags) + '\n')

        head_parts.append(prefix + self.name)

        head = ''.join(head_parts)
        appendix = ''
        if self.described_at:
            fmt = (self.described_at.file, self.described_at.line)
            appendix = u'# %s:%d\n' % fmt

        max_length = self.max_length
        if self.feature:
            max_length = self.feature.max_length

        return strings.rfill(head, max_length + 1, append=appendix)
Example #8
0
    def represent_string(self, string):
        head = ' ' * self.indentation + string
        where = self.described_at

        if self.defined_at:
            where = self.defined_at
        return strings.rfill(head, self.parent.feature.max_length + 1, append=u'# %s:%d\n' % (where.file, where.line))
Example #9
0
    def represented(self):
        make_prefix = lambda x: u"%s%s: " % (u' ' * self.indentation, x)
        if self.outlines:
            prefix = make_prefix(self.language.first_of_scenario_outline)
        else:
            prefix = make_prefix(self.language.first_of_scenario)

        head = prefix + self.name

        return strings.rfill(head, self.feature.max_length + 1, append=u'# %s:%d\n' % (self.described_at.file, self.described_at.line))
Example #10
0
    def represented(self):
        make_prefix = lambda x: u"%s%s: " % (u' ' * self.indentation, x)
        if self.outlines:
            prefix = make_prefix(self.language.first_of_scenario_outline)
        else:
            prefix = make_prefix(self.language.first_of_scenario)

        head = prefix + self.name
        if len(self.tags) > 0:
            head = make_prefix("@" + " @".join(self.tags)) + "\n" + head

        return strings.rfill(head, self.feature.max_length + 1, append=u'# %s:%d\n' % (self.described_at.file, self.described_at.line))
Example #11
0
def test_rfill_simple():
    "strings.rfill simple case"
    assert_equals(
        strings.rfill("ab", 10, "-"),
        "ab--------"
    )
Example #12
0
 def represent_string(self, string):
     head = " " * self.indentation + string
     where = self.described_at
     if self.defined_at:
         where = self.defined_at
     return strings.rfill(head, self.scenario.feature.max_length + 1, append=u"# %s:%d\n" % (where.file, where.line))
Example #13
0
def test_rfill_append():
    "strings.rfill append"
    assert_equals(
        strings.rfill("ab", 10, append="# path/to/file.extension: 2"),
        "ab        # path/to/file.extension: 2"
    )
Example #14
0
def test_rfill_full():
    "strings.rfill full"
    assert_equals(
        strings.rfill("abcdefghij", 10, "|"),
        "abcdefghij"
    )
Example #15
0
def test_rfill_blank():
    "strings.rfill blank"
    assert_equals(
        strings.rfill(" ", 10, "|"),
        " |||||||||"
    )
Example #16
0
def test_rfill_empty():
    "strings.rfill empty"
    assert_equals(
        strings.rfill("", 10, "*"),
        "**********"
    )
Example #17
0
def test_rfill_simple():
    "strings.rfill simple case"
    assert_equals(
        strings.rfill("ab", 10, "-"),
        "ab--------"
    )
Example #18
0
def test_rfill_empty():
    "strings.rfill empty"
    assert_equals(
        strings.rfill("", 10, "*"),
        "**********"
    )
Example #19
0
def test_rfill_append():
    "strings.rfill append"
    assert_equals(
        strings.rfill("ab", 10, append="# path/to/file.extension: 2"),
        "ab        # path/to/file.extension: 2"
    )
Example #20
0
def test_rfill_full():
    "strings.rfill full"
    assert_equals(
        strings.rfill("abcdefghij", 10, "|"),
        "abcdefghij"
    )
Example #21
0
def test_rfill_blank():
    "strings.rfill blank"
    assert_equals(
        strings.rfill(" ", 10, "|"),
        " |||||||||"
    )