=================================== FAILURES ===================================
__________________ CommandTestCase.test_ansi_escape_sequences __________________
self = <tests.test_formatter.CommandTestCase testMethod=test_ansi_escape_sequences>
def test_ansi_escape_sequences(self):
"""Validate that ANSI escape sequences are stripped."""
@click.command(epilog='\033[31mA sample epilog.\033[0m')
@click.option(
'--name',
help='Name to say \033[94mhello\033[0m to.',
required=True,
type=str,
)
@click.option(
'--choice',
help='A sample option with choices',
type=click.Choice(['\033[94mOption1\033[0m', '\033[94mOption2\033[0m']),
)
@click.option(
'--param',
default=lambda: None,
show_default='Something computed at \033[94mruntime\033[0m',
)
def foobar():
"""A sample command with **sparkles**.
We've got \033[31mred text\033[0m, \033[104mblue backgrounds\033[0m, a
dash of \033[1mbold\033[0m and even some \033[4munderlined words\033[0m.
"""
pass
ctx = click.Context(foobar, info_name='foobar')
output = list(ext._format_command(ctx, nested='short'))
> self.assertEqual(
textwrap.dedent(
"""
A sample command with **sparkles**.
We've got red text, blue backgrounds, a
dash of bold and even some underlined words.
.. program:: foobar
.. code-block:: shell
foobar [OPTIONS]
.. rubric:: Options
.. option:: --name <name>
**Required** Name to say hello to.
.. option:: --choice <choice>
A sample option with choices
:options: Option1 | Option2
.. option:: --param <param>
:default: Something computed at runtime
A sample epilog.
"""
).lstrip(),
'\n'.join(output),
)
E AssertionError: "A sa[30 chars].\n\nWe've got red text, blue backgrounds, a\n[408 chars]g.\n" != "A sa[30 chars].\n\n We've got red text, blue back[434 chars]g.\n"
E A sample command with **sparkles**.
E
E - We've got red text, blue backgrounds, a
E + We've got red text, blue backgrounds, a
E ? ++++++++++++
E - dash of bold and even some underlined words.
E + dash of bold and even some underlined words.
E ? ++++++++++++
E +
E
E .. program:: foobar
E .. code-block:: shell
E
E foobar [OPTIONS]
E
E .. rubric:: Options
E
E .. option:: --name <name>
E
E **Required** Name to say hello to.
E
E .. option:: --choice <choice>
E
E A sample option with choices
E
E :options: Option1 | Option2
E
E .. option:: --param <param>
E
E :default: Something computed at runtime
E
E A sample epilog.
tests/test_formatter.py:313: AssertionError
_________________________ CommandTestCase.test_titles __________________________
self = <tests.test_formatter.CommandTestCase testMethod=test_titles>
def test_titles(self):
"""Validate a `click.Command` with nested titles."""
@click.command()
@click.option('--name', help='Name to say hello to.', required=True, type=str)
def hello(name):
"""Prints hello to name given.
Examples
--------
.. code:: bash
my_cli hello --name "Jack"
"""
ctx = click.Context(hello, info_name='hello')
output = list(ext._format_command(ctx, nested='short'))
> self.assertEqual(
textwrap.dedent(
"""
Prints hello to name given.
Examples
--------
.. code:: bash
my_cli hello --name "Jack"
.. program:: hello
.. code-block:: shell
hello [OPTIONS]
.. rubric:: Options
.. option:: --name <name>
**Required** Name to say hello to.
"""
).lstrip(),
'\n'.join(output),
)
E AssertionError: 'Prin[22 chars].\n\nExamples\n--------\n\n.. code:: bash\n\n [189 chars]o.\n' != 'Prin[22 chars].\n\n Examples\n -------[239 chars]o.\n'
E Prints hello to name given.
E
E - Examples
E - --------
E + Examples
E + --------
E
E - .. code:: bash
E + .. code:: bash
E
E - my_cli hello --name "Jack"
E + my_cli hello --name "Jack"
E ? ++++++++++++
E +
E
E .. program:: hello
E .. code-block:: shell
E
E hello [OPTIONS]
E
E .. rubric:: Options
E
E .. option:: --name <name>
E
E **Required** Name to say hello to.
tests/test_formatter.py:255: AssertionError
_____________________ GroupTestCase.test_no_line_wrapping ______________________
self = <tests.test_formatter.GroupTestCase testMethod=test_no_line_wrapping>
def test_no_line_wrapping(self):
r"""Validate behavior when a \b character is present.
https://click.palletsprojects.com/en/7.x/documentation/#preventing-rewrapping
"""
@click.group()
def cli():
"""A sample command group.
\b
This is
a paragraph
without rewrapping.
And this is a paragraph
that will be rewrapped again.
"""
pass
ctx = click.Context(cli, info_name='cli')
output = list(ext._format_command(ctx, nested='short'))
> self.assertEqual(
textwrap.dedent(
"""
A sample command group.
| This is
| a paragraph
| without rewrapping.
And this is a paragraph
that will be rewrapped again.
.. program:: cli
.. code-block:: shell
cli [OPTIONS] COMMAND [ARGS]...
"""
).lstrip(),
'\n'.join(output),
)
E AssertionError: 'A sa[18 chars].\n\n| This is\n| a paragraph\n| without rewra[144 chars]..\n' != 'A sa[18 chars].\n\n \x08\n This is\n [218 chars]..\n'
E A sample command group.
E
E - | This is
E - | a paragraph
E +
E + This is
E + a paragraph
E - | without rewrapping.
E ? ^
E + without rewrapping.
E ? ^^^^^^^^^^^
E
E - And this is a paragraph
E + And this is a paragraph
E ? ++++++++++++
E - that will be rewrapped again.
E + that will be rewrapped again.
E ? ++++++++++++
E +
E
E .. program:: cli
E .. code-block:: shell
E
E cli [OPTIONS] COMMAND [ARGS]...
tests/test_formatter.py:509: AssertionError
=========================== short test summary info ============================
FAILED tests/test_formatter.py::CommandTestCase::test_ansi_escape_sequences
FAILED tests/test_formatter.py::CommandTestCase::test_titles - AssertionError...
FAILED tests/test_formatter.py::GroupTestCase::test_no_line_wrapping - Assert...
========================= 3 failed, 16 passed in 0.09s =========================
Tests currently fail with the latest click: