| 1 |
@issue |
| 2 |
@unicode |
| 3 |
@not_reproducible |
| 4 |
Feature: Issue #487 -- UnicodeEncodeError with ZBSP in multi-line text |
| 5 |
|
| 6 |
. NOTE: I use ZBSP (zero-width space) in multiline text |
| 7 |
. Traceback (most recent call last): |
| 8 |
. File "/usr/bin/behave-2", line 9, in <module> |
| 9 |
. load_entry_point('behave==1.2.5', 'console_scripts', 'behave')() |
| 10 |
. File "/usr/lib/python2.7/site-packages/behave/__main__.py", line 111, in main |
| 11 |
. print(u"ParseError: %s" % e) |
| 12 |
. UnicodeEncodeError: 'ascii' codec can't encode characters in position 92-103: ordinal not in range(128) |
| 13 |
. |
| 14 |
. ANALYSIS: |
| 15 |
. ParseError indicates that the problem occured while parsing the |
| 16 |
. feature file. Feature file encoding is assumed |
| 17 |
|
| 18 |
@not.with_ci=appveyor |
| 19 |
Scenario: |
| 20 |
Given a new working directory |
| 21 |
And a file named "features/steps/pass_steps.py" with: |
| 22 |
""" |
| 23 |
from behave import step |
| 24 |
|
| 25 |
@step('{word:w} step passes') |
| 26 |
def step_passes(context, word): |
| 27 |
pass |
| 28 |
""" |
| 29 |
And a file named "features/steps/steps.py" with: |
| 30 |
""" |
| 31 |
# -*- coding: latin-1 -*- |
| 32 |
from __future__ import print_function |
| 33 |
from behave import step |
| 34 |
|
| 35 |
@step('I use {special_unicode_char:w} in text') |
| 36 |
def step_use_ZBSP_with_text(context, special_unicode_char): |
| 37 |
assert context.text |
| 38 |
print(u"TEXT: %s" % context.text) |
| 39 |
""" |
| 40 |
And a file named "behave.ini" with: |
| 41 |
""" |
| 42 |
[behave] |
| 43 |
show_timings = false |
| 44 |
""" |
| 45 |
And a file named "features/syndrome.feature" with: |
| 46 |
""" |
| 47 |
Feature: |
| 48 |
|
| 49 |
Scenario Outline: Use special unicode char (<comment>) |
| 50 |
Given I use ZBSP in text: |
| 51 |
''' |
| 52 |
HERE we use a ==><special_unicode_char><== SPECIAL UNICODE CHAR. |
| 53 |
''' |
| 54 |
|
| 55 |
Examples: |
| 56 |
| special_unicode_char | comment | |
| 57 |
| ⌘ | MACOS command key symbol | |
| 58 |
| © | copyright sign | |
| 59 |
| € | Euro sign (currency) | |
| 60 |
| xxx XXX | special space | |
| 61 |
""" |
| 62 |
When I run "behave -f plain features/syndrome.feature" |
| 63 |
Then it should pass with: |
| 64 |
""" |
| 65 |
4 scenarios passed, 0 failed, 0 skipped |
| 66 |
""" |
| 67 |
And the command output should contain: |
| 68 |
''' |
| 69 |
Scenario Outline: Use special unicode char (MACOS command key symbol) -- @1.1 |
| 70 |
Given I use ZBSP in text ... passed |
| 71 |
""" |
| 72 |
HERE we use a ==>⌘<== SPECIAL UNICODE CHAR. |
| 73 |
""" |
| 74 |
|
| 75 |
Scenario Outline: Use special unicode char (copyright sign) -- @1.2 |
| 76 |
Given I use ZBSP in text ... passed |
| 77 |
""" |
| 78 |
HERE we use a ==>©<== SPECIAL UNICODE CHAR. |
| 79 |
""" |
| 80 |
|
| 81 |
Scenario Outline: Use special unicode char (Euro sign (currency)) -- @1.3 |
| 82 |
Given I use ZBSP in text ... passed |
| 83 |
""" |
| 84 |
HERE we use a ==>€<== SPECIAL UNICODE CHAR. |
| 85 |
""" |
| 86 |
|
| 87 |
Scenario Outline: Use special unicode char (special space) -- @1.4 |
| 88 |
Given I use ZBSP in text ... passed |
| 89 |
""" |
| 90 |
HERE we use a ==>xxx XXX<== SPECIAL UNICODE CHAR. |
| 91 |
""" |
| 92 |
''' |