test_compat.py
This file
Path
tests/test_compat.py
35 lines · 1.1 KiB · Python
Last changed by
Merge pull request #1186 from RonnyPfannschmidt/jupyter-notebookDavid Lordbefore adoption65386d9
History of this fileTake it
The walk stopped after 200 commits: lines older than 430c50a point at it.
Merge pull request #681 from pgkelley4/masterMarkus Unterwaditzerbefore adoption430c50a
line 1why, one step back1import clickMerge branch '6.x-maintenance'Armin Ronacherbefore adoption7404b06
line 2why, one step back2import pytestMerge pull request #1186 from RonnyPfannschmidt/jupyter-notebookDavid Lordbefore adoption65386d9
line 3why, one step back3from click._compat import should_strip_ansi, WINMerge pull request #681 from pgkelley4/masterMarkus Unterwaditzerbefore adoption430c50a
lines 4–5why, one step back45Merge pull request #1186 from RonnyPfannschmidt/jupyter-notebookDavid Lordbefore adoption65386d9
lines 6–8why, one step back6def test_legacy_callbacks(runner):7 def legacy_callback(ctx, value):8 return value.upper()Merge pull request #681 from pgkelley4/masterMarkus Unterwaditzerbefore adoption430c50a
line 9why, one step back9Merge pull request #1186 from RonnyPfannschmidt/jupyter-notebookDavid Lordbefore adoption65386d9
lines 10–13why, one step back10 @click.command()11 @click.option('--foo', callback=legacy_callback)12 def cli(foo):13 click.echo(foo)Merge pull request #681 from pgkelley4/masterMarkus Unterwaditzerbefore adoption430c50a
line 14why, one step back14Merge pull request #1186 from RonnyPfannschmidt/jupyter-notebookDavid Lordbefore adoption65386d9
lines 15–18why, one step back15 with pytest.warns(Warning, match='Invoked legacy parameter callback'):16 result = runner.invoke(cli, ['--foo', 'wat'])17 assert result.exit_code == 018 assert 'WAT' in result.outputMerge pull request #681 from pgkelley4/masterMarkus Unterwaditzerbefore adoption430c50a
lines 19–22why, one step back192021def test_bash_func_name():22 from click._bashcomplete import get_completion_scriptMerge pull request #865 from stopthatcow/feature/323David Lordbefore adoption39e46e0
line 23why, one step back23 script = get_completion_script('foo-bar baz_blah', '_COMPLETE_VAR', 'bash').strip()Merge pull request #681 from pgkelley4/masterMarkus Unterwaditzerbefore adoption430c50a
lines 24–25why, one step back24 assert script.startswith('_foo_barbaz_blah_completion()')25 assert '_COMPLETE_VAR=complete $1' in scriptMerge pull request #1186 from RonnyPfannschmidt/jupyter-notebookDavid Lordbefore adoption65386d9
lines 26–35why, one step back262728@pytest.mark.xfail(WIN, reason="Jupyter not tested/supported on Windows")29def test_is_jupyter_kernel_output():30 class JupyterKernelFakeStream(object):31 pass3233 # implementation detail, aka cheapskate test34 JupyterKernelFakeStream.__module__ = "ipykernel.faked"35 assert not should_strip_ansi(stream=JupyterKernelFakeStream())