Debian Codegraph @

issue.features/issue0302.feature

raw
1 @issue
2 Feature: Issue #302: Cannot escape pipe in table field value
3
4 Support escaped-pipe characters in cells of a table.
5
6 @setup
7 Scenario: Feature Setup
8 Given a new working directory
9 And a file named "features/steps/steps.py" with:
10 """
11 from behave import then, step
12 from hamcrest import assert_that, equal_to
13
14 @step(u'I use table data with')
15 def step_use_table_data_with_table(context):
16 assert context.table, "REQUIRE: context.table is provided"
17 context.table.require_columns(["name", "value"])
18
19 context.table_data = {}
20 for row in context.table.rows:
21 name = row["name"]
22 value = row["value"]
23 context.table_data[name] = value
24
25 @then(u'table data "{name}" is "{value}"')
26 def step_table_data_name_is_value(context, name, value):
27 table_data = context.table_data
28 actual_value = table_data[name]
29 assert_that(actual_value, equal_to(value))
30 """
31
32 Scenario: Escaped-pipes in table cell
33 Given a file named "features/issue0302_example.feature" with:
34 """
35 Feature:
36 Scenario: Use a table
37 Given I use table data with:
38 | name | value |
39 | alice | one\|two\|three\|four |
40 Then table data "alice" is "one|two|three|four"
41 """
42 When I run "behave -f plain features/issue0302_example.feature"
43 Then it should pass
44 And the command output should not contain:
45 """
46 Traceback (most recent call last):
47 """
48
49
50 Scenario: Leading escaped-pipe in table cell
51 Given a file named "features/issue0302_example2.feature" with:
52 """
53 Feature:
54 Scenario: Use a table
55 Given I use table data with:
56 | name | value |
57 | bob |\|one |
58 Then table data "bob" is "|one"
59 """
60 When I run "behave -f plain features/issue0302_example2.feature"
61 Then it should pass
62
63
64 Scenario: Trailing escaped-pipe in table cell
65 Given a file named "features/issue0302_example3.feature" with:
66 """
67 Feature:
68 Scenario: Use a table
69 Given I use table data with:
70 | name | value |
71 | charly | one\||
72 Then table data "charly" is "one|"
73 """
74 When I run "behave -f plain features/issue0302_example3.feature"
75 Then it should pass
76
77
78 Scenario: Double escaped-pipe in table cell
79 Given a file named "features/issue0302_example4.feature" with:
80 """
81 Feature:
82 Scenario: Use a table
83 Given I use table data with:
84 | name | value |
85 | doro | one\\|two |
86 Then table data "doro" is "one\|two"
87 """
88 When I run "behave -f plain features/issue0302_example4.feature"
89 Then it should pass
90
91