Skip to content
Myr

test_formatting.py

This file

Path

tests/test_formatting.py

50 lines · 1.1 KiB · Python

Last changed by

Fixed a bug with whitespace preservation.Armin Ronacherbefore adoption4e2a329

History of this file

Take it

Added support for explicit terminal widths and disabling of rewrappingArmin Ronacherbefore adoption24d400f

lines 1–18why, one step back
1# -*- coding: utf-8 -*-
2import click345def test_basic_functionality(runner):6 @click.command()7 def cli():8 """First paragraph.910 This is a very long second11 paragraph and not correctly12 wrapped but it will be rewrapped.1314 \b15 This is16 a paragraph17 without rewrapping.18

Fixed a bug with whitespace preservation.Armin Ronacherbefore adoption4e2a329

lines 19–23why, one step back
19 \b
20 121 222 323

Added support for explicit terminal widths and disabling of rewrappingArmin Ronacherbefore adoption24d400f

lines 24–40why, one step back
24 And this is a paragraph
25 that will be rewrapped again.26 """2728 result = runner.invoke(cli, ['--help'], terminal_width=60)29 assert not result.exception30 assert result.output.splitlines() == [31 'Usage: cli [OPTIONS]',32 '',33 ' First paragraph.',34 '',35 ' This is a very long second paragraph and not correctly',36 ' wrapped but it will be rewrapped.',37 '',38 ' This is',39 ' a paragraph',40 ' without rewrapping.',

Fixed a bug with whitespace preservation.Armin Ronacherbefore adoption4e2a329

lines 41–44why, one step back
41 '',
42 ' 1',43 ' 2',44 ' 3',

Added support for explicit terminal widths and disabling of rewrappingArmin Ronacherbefore adoption24d400f

lines 45–50why, one step back
45 '',
46 ' And this is a paragraph that will be rewrapped again.',47 '',48 'Options:',49 ' --help Show this message and exit.',50 ]