from behave import *

use_step_matcher("re")

# ~~~~~ Setup

@given("I start with a clean broker")
def create_the_queues(context):
    pass


@given("the broker is not available")
def client_with_wrong_broker(context):
    pass


@given("I receive the following requests")
def initialize_request_queue(context):
    for row in context.table:
        print(row)

    pass


# ~~~~~ Implementations

@when("I go live with an implementation that adds two numbers")
def step_impl(context):
    pass


@then("the client should consume all requests")
def step_impl(context):
    pass


@step("the client should publish the following responses")
def step_impl(context):
    pass


@then("the client should display to console")
def step_impl(context):
    pass


@when("I go live with an implementation that returns null")
def step_impl(context):
    pass


@then("the client should not consume any request")
def step_impl(context):
    pass


@step("the client should not publish any response")
def step_impl(context):
    pass


@when("I go live with an implementation that throws exception")
def step_impl(context):
    pass


@when("I go live with an implementation that is valid")
def step_impl(context):
    pass


@then("I should get no exception")
def step_impl(context):
    pass


@when("I do a trial run with an implementation that adds two numbers")
def step_impl(context):
    pass


@step("the client should not display to console")
def step_impl(context):
    pass
@@ -301,24 +301,61 @@
 e(context):%0A
+    print(context.table.headings%5B0%5D)%0A
     for row 
@@ -389,16 +389,19 @@
 rint(row
+%5B0%5D
 )%0A%0A    p
@@ -480,60 +480,279 @@
 hat 
-adds two numbers%22)%0Adef step_impl(context):%0A    pass%0A
+(?P%3Cdoes_something%3E.*)%22)%0Adef go_live(context, does_something):%0A    print(does_something)%0A    pass%0A%0A%0A@when(%22I do a trial run with an implementation that (?P%3Cdoes_something%3E.*)%22)%0Adef trial_run(context, does_something):%0A    print(does_something)%0A    pass%0A%0A# ~~~~~ Assertions
 %0A%0A@t
@@ -797,33 +797,43 @@
 uests%22)%0Adef 
-step_impl
+request_queue_empty
 (context):%0A 
@@ -909,203 +909,541 @@
 def 
-step_impl(context):%0A    pass%0A%0A%0A@then(%22the client should display to console%22)%0Adef step_impl(context):%0A    pass%0A%0A%0A@when(%22I go live with an implementation that returns null%22)%0Adef step_impl(context):
+response_queue_contains_expected(context):%0A    print(context.table.headings%5B0%5D)%0A    for row in context.table:%0A        print(row%5B0%5D)%0A    pass%0A%0A%0A@then(%22the client should display to console%22)%0Adef the_client_should_display_to_console(context):%0A    print(context.table.headings%5B0%5D)%0A    for row in context.table:%0A        print(row%5B0%5D)%0A    pass%0A%0A%0A@step(%22the client should not display to console%22)%0Adef the_client_should_not_display_to_console(context):%0A    print(context.table.headings%5B0%5D)%0A    for row in context.table:%0A        print(row%5B0%5D)
 %0A   
@@ -1501,33 +1501,47 @@
 quest%22)%0Adef 
-step_impl
+request_queue_unchanged
 (context):%0A 
@@ -1610,468 +1610,118 @@
 def 
-step_impl(context):%0A    pass%0A%0A%0A@when(%22I go live with an implementation that throws exception%22)%0Adef step_impl(context):%0A    pass%0A%0A%0A@when(%22I go live with an implementation that is valid%22)%0Adef step_impl(context):%0A    pass%0A%0A%0A@then(%22I should get no exception%22)%0Adef step_impl(context):%0A    pass%0A%0A%0A@when(%22I do a trial run with an implementation that adds two numbers%22)%0Adef step_impl(context):%0A    pass%0A%0A%0A@step(%22the client should not display to console%22)%0Adef step_impl
+response_queue_unchanged(context):%0A    pass%0A%0A%0A@then(%22I should get no exception%22)%0Adef i_should_get_no_exception
 (con
@@ -1719,24 +1719,25 @@
 ption(context):%0A    pass
+%0A

Add python regex to match step parameters