<s> from __future__ import absolute_import <EOL> from behave import given , when , then <EOL> import logging <EOL> from six . moves import zip <EOL> spam_log = logging . getLogger ( '<STR_LIT>' ) <EOL> ham_log = logging . getLogger ( '<STR_LIT>' ) <EOL> @ given ( "<STR_LIT>" ) <EOL> def step_impl ( context ) : <EOL> context . testing_stuff = True <EOL> @ given ( "<STR_LIT>" ) <EOL> def step_impl ( context ) : <EOL> context . stuff_set_up = True <EOL> @ given ( "<STR_LIT>" ) <EOL> def step_impl ( context ) : <EOL> assert context . testing_stuff is True <EOL> assert context . stuff_set_up is True <EOL> @ when ( "<STR_LIT>" ) <EOL> def step_impl ( context ) : <EOL> spam_log . error ( '<STR_LIT>' ) <EOL> ham_log . error ( '<STR_LIT>' ) <EOL> @ then ( "<STR_LIT>" ) <EOL> def step_impl ( context ) : <EOL> pass <EOL> @ given ( "<STR_LIT>" ) <EOL> def step_impl ( context , prefix ) : <EOL> context . prefix = prefix <EOL> @ when ( '<STR_LIT>' ) <EOL> def step_impl ( context , suffix ) : <EOL> context . combination = context . prefix + suffix <EOL> @ then ( '<STR_LIT>' ) <EOL> def step_impl ( context , combination ) : <EOL> assert context . combination == combination <EOL> @ given ( '<STR_LIT>' ) <EOL> def step_impl ( context ) : <EOL> assert context . text <EOL> context . saved_text = context . text <EOL> TEXT = '''<STR_LIT>''' <EOL> @ then ( '<STR_LIT>' ) <EOL> def step_impl ( context ) : <EOL> assert context . saved_text , '<STR_LIT>' % ( context . saved_text , ) <EOL> context . saved_text . assert_equals ( TEXT ) <EOL> @ given ( '<STR_LIT>' ) <EOL> def step_impl ( context ) : <EOL> assert context . table <EOL> context . saved_table = context . table <EOL> TABLE_DATA = [ <EOL> dict ( name = '<STR_LIT>' , department = '<STR_LIT>' ) , <EOL> dict ( name = '<STR_LIT>' , department = '<STR_LIT>' ) , <EOL> dict ( name = '<STR_LIT>' , department = '<STR_LIT>' ) , <EOL> ] <EOL> @ then ( '<STR_LIT>' ) <EOL> def step_impl ( context ) : <EOL> assert context . saved_table , '<STR_LIT>' % ( context . saved_table , ) <EOL> for expected , got in zip ( TABLE_DATA , iter ( context . saved_table ) ) : <EOL> assert expected [ '<STR_LIT:name>' ] == got [ '<STR_LIT:name>' ] <EOL> assert expected [ '<STR_LIT>' ] == got [ '<STR_LIT>' ] <EOL> @ then ( '<STR_LIT>' ) <EOL> def step_impl ( context ) : <EOL> assert context . saved_text , '<STR_LIT>' % ( context . saved_text , ) <EOL> expected = TEXT . replace ( '<STR_LIT>' , context . active_outline [ '<STR_LIT>' ] ) <EOL> context . saved_text . assert_equals ( expected ) <EOL> TABLE_DATA = [ <EOL> dict ( name = '<STR_LIT>' , department = '<STR_LIT>' ) , <EOL> dict ( name = '<STR_LIT>' , department = '<STR_LIT>' ) , <EOL> dict ( name = '<STR_LIT>' , department = '<STR_LIT>' ) , <EOL> ] <EOL> @ then ( '<STR_LIT>' ) <EOL> def step_impl ( context ) : <EOL> assert context . saved_table , '<STR_LIT>' % ( context . saved_table , ) <EOL> value = context . active_outline [ '<STR_LIT>' ] <EOL> expected = value + '<STR_LIT>' <EOL> assert context . saved_table [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == expected , '<STR_LIT>' % ( <EOL> context . saved_table [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , expected ) <EOL> @ given ( '<STR_LIT>' ) <EOL> def step_impl ( context , tag ) : <EOL> assert tag in context . tags , '<STR_LIT>' % ( tag , context . tags ) <EOL> if tag == '<STR_LIT>' : <EOL> assert context . is_spammy <EOL> @ given ( '<STR_LIT>' ) <EOL> def step_impl ( context , tag ) : <EOL> assert tag not in context . tags , '<STR_LIT>' % ( tag , context . tags ) <EOL> @ given ( '<STR_LIT>' ) <EOL> def step_impl ( context , argument ) : <EOL> context . argument = argument <EOL> from behave . matchers import register_type <EOL> register_type ( custom = lambda s : s . upper ( ) ) <EOL> @ given ( '<STR_LIT>' ) <EOL> def step_impl ( context , argument ) : <EOL> context . argument = argument <EOL> @ then ( '<STR_LIT>' ) <EOL> def step_impl ( context , argument ) : <EOL> assert context . argument == argument </s>
