| 1 |
@issue |
| 2 |
@unicode |
| 3 |
Feature: Assert with non-ASCII char causes UnicodeDecodeError |
| 4 |
|
| 5 |
. Failing assert with non-ASCII character in its message |
| 6 |
. causes UnicodeDecodeError and silent exit in Python2. |
| 7 |
. |
| 8 |
. RELATED: |
| 9 |
. * features/i18n.unicode_problems.feature |
| 10 |
|
| 11 |
@setup |
| 12 |
Scenario: Feature Setup |
| 13 |
Given a new working directory |
| 14 |
And a file named "features/steps/steps.py" with: |
| 15 |
""" |
| 16 |
from behave import step |
| 17 |
|
| 18 |
@step(u'a step fails with non-ASCII character "{char_code:d}"') |
| 19 |
def step_fails_with_non_ascii_text(context, char_code): |
| 20 |
assert 0 <= char_code <= 255, "RANGE-ERROR: char_code=%s" % char_code |
| 21 |
assert False, "FAIL:"+ chr(char_code) +";" |
| 22 |
""" |
| 23 |
|
| 24 |
Scenario Outline: Syndrome with non-ASCII char <char_code> (format=<format>) |
| 25 |
Given a file named "features/syndrome_0230_<char_code>.feature" with: |
| 26 |
""" |
| 27 |
Feature: |
| 28 |
Scenario: |
| 29 |
Given a step fails with non-ASCII character "<char_code>" |
| 30 |
""" |
| 31 |
When I run "behave -f <format> features/syndrome_0230_<char_code>.feature" |
| 32 |
Then it should fail with: |
| 33 |
""" |
| 34 |
0 scenarios passed, 1 failed, 0 skipped |
| 35 |
0 steps passed, 1 failed, 0 skipped, 0 undefined |
| 36 |
""" |
| 37 |
And the command output should not contain "UnicodeDecodeError" |
| 38 |
But the command output should contain: |
| 39 |
""" |
| 40 |
Assertion Failed: FAIL: |
| 41 |
""" |
| 42 |
|
| 43 |
Examples: |
| 44 |
| format | char_code | |
| 45 |
| plain | 130 | |
| 46 |
| pretty | 190 | |