test_compat.py
This file
Path
tests/test_compat.py
31 lines · 1.0 KiB · Python
Last changed by
Merge pull request #1532 from pallets/drop-python2David Lordbefore adoption97de2c9
History of this fileTake it
1import pytest23from click._compat import should_strip_ansi4from click._compat import WIN567def test_bash_func_name():8 from click._bashcomplete import get_completion_script910 script = get_completion_script("foo-bar baz_blah", "_COMPLETE_VAR", "bash").strip()11 assert script.startswith("_foo_barbaz_blah_completion()")12 assert "_COMPLETE_VAR=complete $1" in script131415def test_zsh_func_name():16 from click._bashcomplete import get_completion_script1718 script = get_completion_script("foo-bar", "_COMPLETE_VAR", "zsh").strip()19 assert script.startswith("#compdef foo-bar")20 assert "compdef _foo_bar_completion foo-bar;" in script21 assert "(( ! $+commands[foo-bar] )) && return 1" in script222324@pytest.mark.xfail(WIN, reason="Jupyter not tested/supported on Windows")25def test_is_jupyter_kernel_output():26 class JupyterKernelFakeStream:27 pass2829 # implementation detail, aka cheapskate test30 JupyterKernelFakeStream.__module__ = "ipykernel.faked"31 assert not should_strip_ansi(stream=JupyterKernelFakeStream())