summaryrefslogtreecommitdiff
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-05-22 01:18:36 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2014-05-22 01:18:36 +0200
commit31043c3dc7b6b355831a2c49c14a1aecda2af3b5 (patch)
tree78846393edcd8cfa9102773e0ee8405b1d81edd6 /tests/test_utils.py
parent39b5df2b12a0e746c5020e0f4379b8e27b44f911 (diff)
downloadclick-31043c3dc7b6b355831a2c49c14a1aecda2af3b5.tar.gz
Added filename format function
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
index dd4d18d..42dcca2 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -9,3 +9,12 @@ def test_echo(runner):
click.echo(b'a', nl=False)
bytes = out.getvalue()
assert bytes == b'\xe2\x98\x83\nDD\n42a'
+
+
+def test_filename_formatting():
+ assert click.format_filename(b'foo.txt') == 'foo.txt'
+ assert click.format_filename(b'/x/foo.txt') == '/x/foo.txt'
+ assert click.format_filename(u'/x/foo.txt') == '/x/foo.txt'
+ assert click.format_filename(u'/x/foo.txt', shorten=True) == 'foo.txt'
+ assert click.format_filename('/x/foo\xff.txt', shorten=True) \
+ == u'foo\ufffd.txt'