Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
magmax authored Aug 21, 2018
2 parents a180227 + 85af721 commit 0c6d4b8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
19 changes: 19 additions & 0 deletions examples/located.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# encoding: utf-8
import os
import sys
import re
sys.path.append(os.path.realpath('.'))
from pprint import pprint

import inquirer

LangQuestion = [
inquirer.List('lang',
message="Select Language",
choices=['English', 'Français', 'Deutsche', 'Español'],
),
]

answers = inquirer.prompt(LangQuestion)

pprint(answers)
2 changes: 1 addition & 1 deletion inquirer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import print_function

__version__ = '2.2.0'
__version__ = '2.3.0'

try:
from .prompt import prompt
Expand Down
2 changes: 2 additions & 0 deletions inquirer/render/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def _print_status_bar(self, render):

def _print_options(self, render):
for message, symbol, color in render.get_options():
if hasattr(message, 'decode'): # python 2
message = message.decode('utf-8')
self.print_line(' {color}{s} {m}{t.normal}',
m=message, color=color, s=symbol)

Expand Down
1 change: 0 additions & 1 deletion inquirer/render/console/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def process_input(self, pressed):
value = self.question.choices[self.current]
raise errors.EndOfInput(getattr(value, 'value', value))

raise errors.EndOfInput(self.question.choices[self.current])
if pressed == key.CTRL_C:
raise KeyboardInterrupt()

Expand Down
10 changes: 10 additions & 0 deletions tests/unit/test_question.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# encoding: utf-8

import os
import shutil
import tempfile
Expand Down Expand Up @@ -176,6 +178,14 @@ def test_factory_list_type(self):
self.assertIsInstance(q, questions.List)
self.assertEquals(name, q.name)

def test_factory_located_list_type(self):
name = 'ñçÑÇ'
q = questions.question_factory('list', name)

self.assertEquals('list', q.kind)
self.assertIsInstance(q, questions.List)
self.assertEquals(name, q.name)

def test_factory_checkbox_type(self):
name = 'foo'
q = questions.question_factory('checkbox', name)
Expand Down

0 comments on commit 0c6d4b8

Please sign in to comment.