Skip to content
Myr

test_utils.py

This file

Path

tests/test_utils.py

20 lines · 679 bytes · Python

Last changed by

Added filename format functionArmin Ronacherbefore adoption31043c3

History of this file

Take it

Added echo testsArmin Ronacherbefore adoption159ffc5

lines 1–11why, one step back
1import click
234def test_echo(runner):5 with runner.isolation() as out:6 click.echo(u'\N{SNOWMAN}')7 click.echo(b'\x44\x44')8 click.echo(42, nl=False)9 click.echo(b'a', nl=False)10 bytes = out.getvalue()11 assert bytes == b'\xe2\x98\x83\nDD\n42a'

Added filename format functionArmin Ronacherbefore adoption31043c3

lines 12–20why, one step back
12
1314def test_filename_formatting():15 assert click.format_filename(b'foo.txt') == 'foo.txt'16 assert click.format_filename(b'/x/foo.txt') == '/x/foo.txt'17 assert click.format_filename(u'/x/foo.txt') == '/x/foo.txt'18 assert click.format_filename(u'/x/foo.txt', shorten=True) == 'foo.txt'19 assert click.format_filename('/x/foo\xff.txt', shorten=True) \20 == u'foo\ufffd.txt'