Пример #1
0
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("/x/foo.txt") == "/x/foo.txt"
    assert click.format_filename("/x/foo.txt", shorten=True) == "foo.txt"

    # filesystem encoding on windows permits this.
    if not WIN:
        assert click.format_filename(b"/x/foo\xff.txt", shorten=True) == "foo\udcff.txt"
Пример #2
0
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'

    # filesystem encoding on windows permits this.
    if not WIN:
        assert click.format_filename(b'/x/foo\xff.txt', shorten=True) \
            == u'foo\ufffd.txt'
Пример #3
0
def cli(ctx, path):
    """Initializes a repository."""
    if path is None:
        path = ctx.home
    ctx.log('Initialized the repository in %s', click.format_filename(path))