diff options
| author | shimizukawa <shimizukawa@gmail.com> | 2013-06-09 09:06:21 +0900 |
|---|---|---|
| committer | shimizukawa <shimizukawa@gmail.com> | 2013-06-09 09:06:21 +0900 |
| commit | c48fd4ee27448b18581549d689e523b6e7060891 (patch) | |
| tree | 2de37c2ed00d9a6b751a14bb0c313fb1e90d5e32 /tests/test_quickstart.py | |
| parent | 73d184b87a7ac1bfe7da983415f17b2454e05edb (diff) | |
| download | sphinx-c48fd4ee27448b18581549d689e523b6e7060891.tar.gz | |
Fix sphinx-quickstart raises UnicodeEncodeError if "Project version" includes non-ASCII characters. Closes #1188
Diffstat (limited to 'tests/test_quickstart.py')
| -rw-r--r-- | tests/test_quickstart.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index 2340e04b..f2de2f56 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -28,6 +28,12 @@ def mock_raw_input(answers, needanswer=False): raise AssertionError('answer for %r missing and no default ' 'present' % prompt) called.add(prompt) + if sys.version_info < (3, 0): + prompt = str(prompt) # Python2.x raw_input emulation + # `raw_input` encode `prompt` by default encoding to print. + else: + prompt = unicode(prompt) # Python3.x input emulation + # `input` decode prompt by default encoding before print. for question in answers: if prompt.startswith(qs.PROMPT_PREFIX + question): return answers[question] @@ -95,6 +101,16 @@ def test_do_prompt(): raises(AssertionError, qs.do_prompt, d, 'k6', 'Q6', validator=qs.boolean) +def test_do_prompt_with_multibyte(): + d = {} + answers = { + 'Q1': ur'\u30c9\u30a4\u30c4', + } + qs.term_input = mock_raw_input(answers) + qs.do_prompt(d, 'k1', 'Q1', default=ur'\u65e5\u672c') + assert d['k1'] == ur'\u30c9\u30a4\u30c4' + + @with_tempdir def test_quickstart_defaults(tempdir): answers = { |
