Skip to content

Commit

Permalink
Updates to satisfy PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Aug 14, 2022
1 parent 6c9da13 commit ccf5382
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions questionary/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ def unsafe_prompt(
if "type" not in question_config:
raise PromptParameterException("type")
# every type except 'print' needs a name
if "name" not in question_config and question_config["type"] != "print": # noqa
if "name" not in question_config and question_config["type"] != "print":
raise PromptParameterException("name")

_kwargs = kwargs.copy()
_kwargs.update(question_config)

_type = _kwargs.pop("type")
_filter = _kwargs.pop("filter", None)
name = _kwargs.pop("name", None) if _type == "print" else _kwargs.pop("name") # noqa
name = _kwargs.pop("name", None) if _type == "print" else _kwargs.pop("name")
when = _kwargs.pop("when", None)

if true_color:
Expand Down
5 changes: 4 additions & 1 deletion tests/test_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from questionary.prompt import PromptParameterException
from questionary.prompt import prompt
from tests.utils import patched_prompt


def test_missing_message():
Expand Down Expand Up @@ -65,4 +66,6 @@ def test_missing_print_message():
def test_print_no_name():
"""'print' type doesn't require a name so it
should not throw PromptParameterException"""
assert prompt([{"type": "print", "message": "Hello World"}]) == {}
questions = [{"type": "print", "message": "Hello World"}]
result = patched_prompt(questions, "")
assert result == {}

0 comments on commit ccf5382

Please sign in to comment.