<s> import re <EOL> from sure import expect <EOL> from boltons . dictutils import OrderedMultiDict as OMD <EOL> from lib . modules . event_emitter_2 import EventEmitter2 <EOL> def echo ( ) : <EOL> pass <EOL> class TestEventEmitter2 ( object ) : <EOL> def setUp ( self ) : <EOL> self . ee = EventEmitter2 ( ) <EOL> def tearDown ( self ) : <EOL> self . ee = None <EOL> def test_ee2_properties ( self ) : <EOL> self . ee . should . have . property ( '<STR_LIT>' ) <EOL> self . ee . events . should . be . a ( OMD ) <EOL> self . ee . should . have . property ( '<STR_LIT>' ) <EOL> self . ee . should . have . property ( '<STR_LIT>' ) <EOL> self . ee . should . have . property ( '<STR_LIT>' ) . being . equal ( self . ee . add_listener ) <EOL> self . ee . should . have . property ( '<STR_LIT>' ) . being . equal ( self . ee . remove_listener ) <EOL> self . ee . should . have . property ( '<STR_LIT>' ) <EOL> def test_add_listener_should_add_a_listener_with_call_count ( self ) : <EOL> return_value = self . ee . add_listener ( '<STR_LIT>' , echo , <NUM_LIT:100> ) <EOL> expect ( return_value ) . to . equal ( True ) <EOL> event_key = re . compile ( '<STR_LIT>' ) <EOL> expect ( self . ee . events . keys ( ) ) . to . equal ( [ event_key ] ) <EOL> expect ( self . ee . events [ event_key ] [ '<STR_LIT>' ] ) . to . equal ( echo ) <EOL> expect ( self . ee . events [ event_key ] [ '<STR_LIT>' ] ) . to . equal ( <NUM_LIT:0> ) <EOL> expect ( self . ee . events [ event_key ] [ '<STR_LIT>' ] ) . to . equal ( <NUM_LIT:100> ) <EOL> def test_remove_listener_should_detach_event_if_listener_count_is_one ( self ) : <EOL> self . ee . add_listener ( '<STR_LIT>' , echo , <NUM_LIT:100> ) <EOL> return_value = self . ee . remove_listener ( '<STR_LIT>' , echo ) <EOL> expect ( return_value ) . to . equal ( True ) <EOL> expect ( self . ee . events ) . to . be . a ( OMD ) <EOL> expect ( self . ee . events . keys ( ) ) . to . equal ( [ ] ) </s>
