<s> from expects import * <EOL> from doublex_expects import have_been_called_with <EOL> from doublex import Spy <EOL> from spec . object_mother import * <EOL> from mamba import reporter <EOL> from mamba . example_group import ExampleGroup <EOL> from mamba . infrastructure import total_seconds <EOL> with description ( ExampleGroup ) : <EOL> with before . each : <EOL> self . example_group = an_example_group ( ) <EOL> self . reporter = Spy ( reporter . Reporter ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . name ) . to ( be ( IRRELEVANT_SUBJECT ) ) <EOL> with context ( '<STR_LIT>' ) : <EOL> with before . each : <EOL> self . example = an_example ( ) <EOL> self . example_group . append ( self . example ) <EOL> self . example_group . run ( self . reporter ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example . was_run ) . to ( be_true ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( total_seconds ( self . example_group . elapsed_time ) ) . to ( be_above ( <NUM_LIT:0> ) ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . reporter . example_group_started ) . to ( have_been_called_with ( self . example_group ) ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . reporter . example_group_finished ) . to ( have_been_called_with ( self . example_group ) ) <EOL> with context ( '<STR_LIT>' ) : <EOL> with before . each : <EOL> self . example_group . append ( a_failing_example ( ) ) <EOL> self . example_group . run ( self . reporter ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . failed ) . to ( be_true ) <EOL> with context ( '<STR_LIT>' ) : <EOL> with before . each : <EOL> class _ErrorRaiser ( object ) : <EOL> def _raise_error ( self ) : <EOL> raise ValueError ( ) <EOL> self . example_group . hooks [ '<STR_LIT>' ] = [ ] <EOL> self . example_group . hooks [ '<STR_LIT>' ] . append ( _ErrorRaiser . _raise_error ) <EOL> with context ( '<STR_LIT>' ) : <EOL> with before . each : <EOL> self . example_group . append ( an_example ( ) ) <EOL> self . example_group . run ( self . reporter ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . examples [ <NUM_LIT:0> ] . failed ) . to ( be_true ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . examples [ <NUM_LIT:0> ] . error ) . not_to ( be_none ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . examples [ <NUM_LIT:0> ] . was_run ) . to ( be_false ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . reporter . example_failed ) . to ( have_been_called_with ( self . example_group . examples [ <NUM_LIT:0> ] ) ) <EOL> with context ( '<STR_LIT>' ) : <EOL> with before . each : <EOL> self . example_group . append ( an_example_group ( ) ) <EOL> self . example_group . examples [ <NUM_LIT:0> ] . append ( an_example ( ) ) <EOL> self . example_group . run ( self . reporter ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . examples [ <NUM_LIT:0> ] . failed ) . to ( be_true ) <EOL> with it ( '<STR_LIT>' ) : <EOL> expect ( self . example_group . examples [ <NUM_LIT:0> ] . error ) . not_to ( be_none ) </s>
