How to use the questionary.Separator function in questionary

To help you get started, we’ve selected a few questionary examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmbo / questionary / tests / prompts / test_checkbox.py View on Github external
def test_select_all_deselect():
    message = "Foo message"
    kwargs = {
        "choices": [
            {"name": "foo", "checked": True},
            Separator(),
            {"name": "bar", "disabled": "nope"},
            "bazz",
            Separator("--END--"),
        ]
    }
    text = KeyInputs.UP + "a" + "a" + KeyInputs.ENTER + "\r"

    result, cli = feed_cli_with_input("checkbox", message, text, **kwargs)
    assert result == []
github tmbo / questionary / tests / prompts / test_checkbox.py View on Github external
def test_select_all():
    message = "Foo message"
    kwargs = {
        "choices": [
            {"name": "foo", "checked": True},
            Separator(),
            {"name": "bar", "disabled": "nope"},
            "bazz",
            Separator("--END--"),
        ]
    }
    text = KeyInputs.UP + "a" + KeyInputs.ENTER + "\r"

    result, cli = feed_cli_with_input("checkbox", message, text, **kwargs)
    assert result == ["foo", "bazz"]
github tmbo / questionary / tests / prompts / test_rawselect.py View on Github external
def test_invalid_shortcuts():
    message = "Foo message"
    kwargs = {
        "choices": [
            {"name": "foo", "key": "asd"},
            Separator(),
            {"name": "bar", "key": "1"},
            "bazz",
            Separator("--END--"),
        ]
    }
    text = "1" + KeyInputs.ENTER + "\r"

    with pytest.raises(ValueError):
        feed_cli_with_input("rawselect", message, text, **kwargs)
github tmbo / questionary / tests / prompts / test_checkbox.py View on Github external
def test_select_invert():
    message = "Foo message"
    kwargs = {
        "choices": [
            {"name": "foo", "checked": True},
            Separator(),
            {"name": "bar", "disabled": "nope"},
            "bazz",
            Separator("--END--"),
        ]
    }
    text = KeyInputs.UP + "i" + KeyInputs.ENTER + "\r"

    result, cli = feed_cli_with_input("checkbox", message, text, **kwargs)
    assert result == ["bazz"]
github tmbo / questionary / tests / prompts / test_select.py View on Github external
def test_separator_up():
    message = "Foo message"
    kwargs = {"choices": ["foo", Separator(), "bazz", Separator("--END--")]}
    text = KeyInputs.UP + KeyInputs.UP + KeyInputs.ENTER + "\r"

    result, cli = feed_cli_with_input("select", message, text, **kwargs)
    assert result == "foo"
github tmbo / questionary / tests / prompts / test_checkbox.py View on Github external
def test_select_all():
    message = "Foo message"
    kwargs = {
        "choices": [
            {"name": "foo", "checked": True},
            Separator(),
            {"name": "bar", "disabled": "nope"},
            "bazz",
            Separator("--END--"),
        ]
    }
    text = KeyInputs.UP + "a" + KeyInputs.ENTER + "\r"

    result, cli = feed_cli_with_input("checkbox", message, text, **kwargs)
    assert result == ["foo", "bazz"]
github tmbo / questionary / tests / prompts / test_checkbox.py View on Github external
def test_separator_down():
    message = "Foo message"
    kwargs = {"choices": ["foo", Separator(), "bazz"]}
    text = KeyInputs.DOWN + KeyInputs.SPACE + KeyInputs.ENTER + "\r"

    result, cli = feed_cli_with_input("checkbox", message, text, **kwargs)
    assert result == ["bazz"]
github tmbo / questionary / examples / select.py View on Github external
def ask_pystyle(**kwargs):
    # create the question object
    question = questionary.select(
        "What do you want to do?",
        qmark="😃",
        choices=[
            "Order a pizza",
            "Make a reservation",
            Separator(),
            "Ask for opening hours",
            Choice("Contact support", disabled="Unavailable at this time"),
            "Talk to the receptionist",
        ],
        style=custom_style_dope,
        **kwargs,
    )

    # prompt the user for an answer
    return question.ask()
github tmbo / questionary / examples / checkbox.py View on Github external
def ask_pystyle(**kwargs):
    # create the question object
    question = questionary.checkbox(
        "Select toppings",
        qmark="😃",
        choices=[
            Choice("foo", checked=True),
            Separator(),
            Choice("bar", disabled="nope"),
            "bazz",
            Separator("--END--"),
        ],
        style=custom_style_dope,
        **kwargs,
    )

    # prompt the user for an answer
    return question.ask()