def print_example_running(scenario, outline, steps):
    if not outline:
        return

    print
    print u" ",
    print term.bold(_(u"Example #%d:" % (
        scenario.outlines.index(outline) + 1)))
    print strings.represent_table([outline.keys(), outline.values()],
                                  indent=4)
    print
Exemplo n.º 2
0
def test_represent_table_allows_empty():
    """
    Test representing a table with an empty cell
    """

    table = [
        ['name', 'age'],
        [u'Gabriel | Falcão', 22],
        ['Miguel | Arcanjo', ''],
    ]

    assert_equals(
        strings.represent_table(table),
        ur"| name              | age |" "\n"
        ur"| Gabriel \| Falcão | 22  |" "\n"
        ur"| Miguel \| Arcanjo |     |"
    )
Exemplo n.º 3
0
def test_represent_table_escapes_pipe():
    """
    Test representing a table with escaping
    """

    table = [
        ['name', 'age'],
        [u'Gabriel | Falcão', 22],
        ['Miguel | Arcanjo', 19],
    ]

    assert_equals(
        strings.represent_table(table),
        ur"| name              | age |" "\n"
        ur"| Gabriel \| Falcão | 22  |" "\n"
        ur"| Miguel \| Arcanjo | 19  |"
    )
Exemplo n.º 4
0
def test_represent_table():
    """
    Test representing a table
    """

    table = [
        ['name', 'age'],
        [u'Gabriel Falcão', 22],
        ['Miguel', 19],
    ]

    assert_equals(
        strings.represent_table(table),
        u"| name           | age |\n"
        u"| Gabriel Falcão | 22  |\n"
        u"| Miguel         | 19  |"
    )
Exemplo n.º 5
0
    def represent_outlines(self, indent=4):
        """
        Render the outlines table
        """

        return strings.represent_table(self.outlines_table, indent=indent)
Exemplo n.º 6
0
    def represent_hashes(self, indent=6, **kwargs):
        """
        Render the table
        """

        return strings.represent_table(self.table, indent=indent, **kwargs)