@then('the tag expression selects elements with tags')
def step_then_tag_expression_selects_elements_with_tags(context):
 assert context.tag_expression, 'REQUIRE: context.tag_expression'
 context.table.require_columns(['tags', 'selected?'])
 tag_expression = context.tag_expression
 expected = []
 actual = []
 for row in context.table.rows:
  element_tags = convert_model_element_tags(row['tags'])
  expected_element_selected = convert_yesno(row['selected?'])
  actual_element_selected = tag_expression.check(element_tags)
  expected.append((element_tags, expected_element_selected))
  actual.append((element_tags, actual_element_selected))
 assert_that(actual, equal_to(expected))

@ then ( 'the tag expression selects elements with tags' ) def step_then_tag_expression_selects_elements_with_tags ( context ) : assert context . tag_expression , 'REQUIRE: context.tag_expression' context . table . require_columns ( [ 'tags' , 'selected?' ] ) tag_expression = context . tag_expression expected = [ ] actual = [ ] for row in context . table . rows : element_tags = convert_model_element_tags ( row [ 'tags' ] ) expected_element_selected = convert_yesno ( row [ 'selected?' ] ) actual_element_selected = tag_expression . check ( element_tags ) expected . append ( ( element_tags , expected_element_selected ) ) actual . append ( ( element_tags , actual_element_selected ) ) assert_that ( actual , equal_to ( expected ) )
checks if a tag expression selects an element with the given tags .