Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ability for Scenario outline table values to be inserted into step tables #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion freshen/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ def set_values(self, value_dict):
result = copy.deepcopy(self)
for name, value in value_dict.iteritems():
result.match = result.match.replace("<%s>" % name, value)

if result.arg is not None and isinstance(result.arg, Table):
new_rows = []
for row in result.arg.rows:
new_items = []
for item in row:
for name, value in value_dict.iteritems():
item = item.replace("<%s>" % name, value)
new_items.append(item)
new_rows.append(new_items)
result.arg = Table(result.arg.headings, new_rows)

return result


Expand Down Expand Up @@ -187,7 +199,7 @@ def process_then_step(s):
def process_and_but_step(orig, loc, s):
if last_step_type[0] == None:
raise ParseFatalException(orig, loc,
"'And' or 'But' steps can only come after 'Given', 'When', or 'Then'")
"'And' or 'But' steps can only come after 'Given', 'When', or 'Then'")
return (s[0], last_step_type[0])

def process_string(s):
Expand Down