]>
Commit | Line | Data |
---|---|---|
aee94f69 TL |
1 | from behave import * |
2 | from utils import * | |
3 | import re | |
4 | ||
5 | @when("I run") | |
6 | def run_step(context): | |
7 | context.output = run_commands(context.text) | |
8 | ||
9 | @then("I get") | |
10 | def verify_result_step(context): | |
11 | print(f"Output is:\n{context.output}\n--------------\n") | |
12 | assert context.text == context.output | |
13 | ||
14 | @then("I get something like") | |
15 | def verify_fuzzy_result_step(context): | |
16 | output_lines = context.output.split("\n") | |
17 | expected_lines = context.text.split("\n") | |
18 | num_lines = min(len(output_lines), len(expected_lines)) | |
19 | for n in range(num_lines): | |
20 | if not re.match(expected_lines[n], output_lines[n]): | |
21 | raise |