<s> '''<STR_LIT>''' <EOL> from chai import Chai <EOL> from haigha . classes import basic_class <EOL> from haigha . classes . protocol_class import ProtocolClass <EOL> from haigha . classes . basic_class import BasicClass <EOL> from haigha . frames . method_frame import MethodFrame <EOL> from haigha . writer import Writer <EOL> from haigha . reader import Reader <EOL> from haigha . message import Message <EOL> from haigha . connection import Connection <EOL> from collections import deque <EOL> class BasicClassTest ( Chai ) : <EOL> def setUp ( self ) : <EOL> super ( BasicClassTest , self ) . setUp ( ) <EOL> ch = mock ( ) <EOL> ch . channel_id = <NUM_LIT> <EOL> ch . logger = mock ( ) <EOL> self . klass = BasicClass ( ch ) <EOL> def test_init ( self ) : <EOL> expect ( ProtocolClass . __init__ ) . args ( '<STR_LIT:foo>' , a = '<STR_LIT:b>' ) <EOL> klass = BasicClass . __new__ ( BasicClass ) <EOL> klass . __init__ ( '<STR_LIT:foo>' , a = '<STR_LIT:b>' ) <EOL> assert_equals ( <EOL> { <EOL> <NUM_LIT:11> : klass . _recv_qos_ok , <EOL> <NUM_LIT> : klass . _recv_consume_ok , <EOL> <NUM_LIT> : klass . _recv_cancel_ok , <EOL> <NUM_LIT:50> : klass . _recv_return , <EOL> <NUM_LIT> : klass . _recv_deliver , <EOL> <NUM_LIT> : klass . _recv_get_response , <EOL> <NUM_LIT> : klass . _recv_get_response , <EOL> <NUM_LIT> : klass . _recv_recover_ok , <EOL> } , klass . dispatch_map ) <EOL> assert_equals ( <NUM_LIT:0> , klass . _consumer_tag_id ) <EOL> assert_equals ( deque ( ) , klass . _pending_consumers ) <EOL> assert_equals ( { } , klass . _consumer_cb ) <EOL> assert_equals ( deque ( ) , klass . _get_cb ) <EOL> assert_equals ( deque ( ) , klass . _recover_cb ) <EOL> assert_equals ( deque ( ) , klass . _cancel_cb ) <EOL> assert_equals ( None , klass . _return_listener ) <EOL> def test_cleanup ( self ) : <EOL> self . klass . _cleanup ( ) <EOL> assert_equals ( None , self . klass . _pending_consumers ) <EOL> assert_equals ( None , self . klass . _consumer_cb ) <EOL> assert_equals ( None , self . klass . _get_cb ) <EOL> assert_equals ( None , self . klass . _recover_cb ) <EOL> assert_equals ( None , self . klass . _cancel_cb ) <EOL> assert_equals ( None , self . klass . _channel ) <EOL> assert_equals ( None , self . klass . dispatch_map ) <EOL> assert_equals ( None , self . klass . _return_listener ) <EOL> def test_set_return_listener ( self ) : <EOL> cb = lambda * args : None <EOL> self . klass . set_return_listener ( cb ) <EOL> assert_is ( cb , self . klass . _return_listener ) <EOL> self . klass . set_return_listener ( None ) <EOL> assert_is ( None , self . klass . _return_listener ) <EOL> def test_set_invalid_listener_raises_valueerror ( self ) : <EOL> assert_raises ( ValueError , self . klass . set_return_listener , '<STR_LIT:foo>' ) <EOL> assert_is ( None , self . klass . _return_listener ) <EOL> def test_generate_consumer_tag ( self ) : <EOL> assert_equals ( <NUM_LIT:0> , self . klass . _consumer_tag_id ) <EOL> assert_equals ( '<STR_LIT>' , self . klass . _generate_consumer_tag ( ) ) <EOL> assert_equals ( <NUM_LIT:1> , self . klass . _consumer_tag_id ) <EOL> def test_qos_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_long ) . args ( <NUM_LIT:0> ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( <NUM_LIT:0> ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:10> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_qos_ok ) <EOL> self . klass . qos ( ) <EOL> def test_qos_with_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_long ) . args ( <NUM_LIT:1> ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( <NUM_LIT:2> ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( <NUM_LIT:3> ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:10> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_qos_ok ) <EOL> self . klass . qos ( prefetch_size = <NUM_LIT:1> , prefetch_count = <NUM_LIT:2> , is_global = <NUM_LIT:3> ) <EOL> def test_recv_qos_ok ( self ) : <EOL> self . klass . _recv_qos_ok ( '<STR_LIT>' ) <EOL> def test_consume_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( self . klass . allow_nowait ) . returns ( True ) <EOL> expect ( self . klass . _generate_consumer_tag ) . returns ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( self . klass . default_ticket ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bits ) . args ( False , True , False , True ) . returns ( w ) <EOL> expect ( w . write_table ) . args ( { } ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> assert_equals ( deque ( ) , self . klass . _pending_consumers ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> self . klass . consume ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_equals ( deque ( ) , self . klass . _pending_consumers ) <EOL> assert_equals ( { '<STR_LIT>' : '<STR_LIT>' } , self . klass . _consumer_cb ) <EOL> def test_consume_with_args_including_nowait_and_ticket ( self ) : <EOL> w = mock ( ) <EOL> stub ( self . klass . allow_nowait ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( '<STR_LIT:train>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bits ) . args ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , False ) . returns ( w ) <EOL> expect ( w . write_table ) . args ( { } ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_consume_ok ) <EOL> assert_equals ( deque ( ) , self . klass . _pending_consumers ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> self . klass . consume ( '<STR_LIT>' , '<STR_LIT>' , consumer_tag = '<STR_LIT>' , no_local = '<STR_LIT>' , <EOL> no_ack = '<STR_LIT>' , exclusive = '<STR_LIT>' , nowait = False , ticket = '<STR_LIT:train>' ) <EOL> assert_equals ( <EOL> deque ( [ ( '<STR_LIT>' , None ) ] ) , self . klass . _pending_consumers ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_consume_with_args_including_nowait_no_ticket_with_callback ( self ) : <EOL> w = mock ( ) <EOL> stub ( self . klass . _generate_consumer_tag ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( self . klass . default_ticket ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bits ) . args ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , False ) . returns ( w ) <EOL> expect ( w . write_table ) . args ( { } ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:20> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_consume_ok ) <EOL> self . klass . _pending_consumers = deque ( [ ( '<STR_LIT>' , None ) ] ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> self . klass . consume ( '<STR_LIT>' , '<STR_LIT>' , consumer_tag = '<STR_LIT>' , no_local = '<STR_LIT>' , <EOL> no_ack = '<STR_LIT>' , exclusive = '<STR_LIT>' , nowait = False , cb = '<STR_LIT>' ) <EOL> assert_equals ( deque ( <EOL> [ ( '<STR_LIT>' , None ) , ( '<STR_LIT>' , '<STR_LIT>' ) ] ) , self . klass . _pending_consumers ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_recv_consume_ok ( self ) : <EOL> frame = mock ( ) <EOL> cb = mock ( ) <EOL> expect ( frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> self . klass . _pending_consumers = deque ( <EOL> [ ( '<STR_LIT>' , None ) , ( '<STR_LIT>' , cb ) ] ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> self . klass . _recv_consume_ok ( frame ) <EOL> assert_equals ( { '<STR_LIT>' : '<STR_LIT>' } , self . klass . _consumer_cb ) <EOL> assert_equals ( deque ( [ ( '<STR_LIT>' , cb ) ] ) , self . klass . _pending_consumers ) <EOL> frame2 = mock ( ) <EOL> expect ( frame2 . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( cb ) <EOL> self . klass . _recv_consume_ok ( frame2 ) <EOL> assert_equals ( <EOL> { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } , self . klass . _consumer_cb ) <EOL> assert_equals ( deque ( ) , self . klass . _pending_consumers ) <EOL> def test_cancel_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( self . klass . allow_nowait ) . returns ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:30> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . logger . info ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> self . klass . cancel ( ) <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_cancel_nowait_and_consumer_tag_not_registered ( self ) : <EOL> w = mock ( ) <EOL> expect ( self . klass . allow_nowait ) . returns ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:30> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . logger . warning ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> self . klass . cancel ( consumer_tag = '<STR_LIT>' ) <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_cancel_wait_without_cb ( self ) : <EOL> w = mock ( ) <EOL> stub ( self . klass . allow_nowait ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:30> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_cancel_ok ) <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> self . klass . cancel ( nowait = False ) <EOL> assert_equals ( deque ( [ None ] ) , self . klass . _cancel_cb ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_cancel_wait_with_cb ( self ) : <EOL> w = mock ( ) <EOL> stub ( self . klass . allow_nowait ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:30> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_cancel_ok ) <EOL> self . klass . _cancel_cb = deque ( [ '<STR_LIT>' ] ) <EOL> self . klass . cancel ( nowait = False , cb = '<STR_LIT>' ) <EOL> assert_equals ( deque ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , self . klass . _cancel_cb ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_cancel_resolves_to_ctag_when_consumer_arg_supplied ( self ) : <EOL> w = mock ( ) <EOL> expect ( self . klass . allow_nowait ) . returns ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:30> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . logger . info ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> self . klass . cancel ( consumer = '<STR_LIT>' ) <EOL> assert_equals ( deque ( ) , self . klass . _cancel_cb ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_recv_cancel_ok_when_consumer_and_callback ( self ) : <EOL> frame = mock ( ) <EOL> cancel_cb = mock ( ) <EOL> expect ( frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = '<STR_LIT:foo>' <EOL> self . klass . _cancel_cb = deque ( [ cancel_cb , mock ( ) ] ) <EOL> expect ( self . klass . logger . info ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> expect ( cancel_cb ) <EOL> self . klass . _recv_cancel_ok ( frame ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _cancel_cb ) ) <EOL> assert_false ( cancel_cb in self . klass . _cancel_cb ) <EOL> def test_recv_cancel_ok_when_no_consumer_or_callback ( self ) : <EOL> frame = mock ( ) <EOL> expect ( frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . logger . warning ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . klass . _cancel_cb = deque ( [ None , mock ( ) ] ) <EOL> self . klass . _recv_cancel_ok ( frame ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _cancel_cb ) ) <EOL> assert_false ( None in self . klass . _cancel_cb ) <EOL> def test_lookup_consumer_tag_by_consumer_with_match_found ( self ) : <EOL> consumer = mock ( ) <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = consumer <EOL> consumer_tag = self . klass . _lookup_consumer_tag_by_consumer ( consumer ) <EOL> assert_equals ( '<STR_LIT>' , consumer_tag ) <EOL> def test_lookup_consumer_tag_by_consumer_with_match_not_found ( self ) : <EOL> consumer = mock ( ) <EOL> consumer_tag = self . klass . _lookup_consumer_tag_by_consumer ( consumer ) <EOL> assert_is ( None , consumer_tag ) <EOL> def test_purge_consumer_by_tag_with_match_found ( self ) : <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = mock ( ) <EOL> expect ( self . klass . logger . info ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . klass . _purge_consumer_by_tag ( '<STR_LIT>' ) <EOL> assert_equals ( { } , self . klass . _consumer_cb ) <EOL> def test_purge_consumer_by_tag_with_match_not_found ( self ) : <EOL> expect ( self . klass . logger . warning ) . args ( <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . klass . _purge_consumer_by_tag ( '<STR_LIT>' ) <EOL> def test_publish_default_args ( self ) : <EOL> args = Writer ( ) <EOL> msg = Message ( '<STR_LIT>' ) <EOL> args . write_short ( <NUM_LIT:0> ) . write_shortstr ( '<STR_LIT>' ) . write_shortstr ( '<STR_LIT>' ) . write_bits ( False , False ) <EOL> self . klass . channel . connection . frame_max = <NUM_LIT:3> <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , args ) . returns ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , len ( msg ) , msg . properties ) . returns ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) . create_frames ) . args ( <EOL> <NUM_LIT> , msg . body , <NUM_LIT:3> ) . returns ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . publish ( msg , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_publish_with_args ( self ) : <EOL> w = mock ( ) <EOL> msg = Message ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bits ) . args ( '<STR_LIT:m>' , '<STR_LIT:i>' ) <EOL> self . klass . channel . connection . frame_max = <NUM_LIT:3> <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:0> , len ( msg ) , msg . properties ) . returns ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) . create_frames ) . args ( <EOL> <NUM_LIT> , msg . body , <NUM_LIT:3> ) . returns ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . publish ( <EOL> msg , '<STR_LIT>' , '<STR_LIT>' , mandatory = '<STR_LIT:m>' , immediate = '<STR_LIT:i>' , ticket = '<STR_LIT>' ) <EOL> def test_return_msg ( self ) : <EOL> args = Writer ( ) <EOL> args . write_short ( <NUM_LIT:3> ) <EOL> args . write_shortstr ( '<STR_LIT>' ) <EOL> args . write_shortstr ( '<STR_LIT>' ) <EOL> args . write_shortstr ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:50> , args ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . return_msg ( <NUM_LIT:3> , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_recv_return_with_cb ( self ) : <EOL> msg = mock ( ) <EOL> msg . return_info = { <EOL> '<STR_LIT>' : self . klass . channel , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> cb = mock ( ) <EOL> self . klass . _return_listener = cb <EOL> expect ( self . klass . _read_returned_msg ) . args ( '<STR_LIT>' ) . returns ( msg ) <EOL> expect ( cb ) . args ( msg ) <EOL> self . klass . _recv_return ( '<STR_LIT>' ) <EOL> def test_recv_return_without_cb ( self ) : <EOL> msg = mock ( ) <EOL> msg . properties = dict ( ) <EOL> msg . return_info = { <EOL> '<STR_LIT>' : self . klass . channel , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> expect ( self . klass . _read_returned_msg ) . args ( '<STR_LIT>' ) . returns ( msg ) <EOL> expect ( self . klass . logger . error ) . args ( <EOL> "<STR_LIT>" , <EOL> msg . return_info , <EOL> msg . properties ) <EOL> self . klass . _recv_return ( '<STR_LIT>' ) <EOL> def test_recv_deliver_with_cb ( self ) : <EOL> msg = mock ( ) <EOL> msg . delivery_info = { '<STR_LIT>' : '<STR_LIT>' } <EOL> cb = mock ( ) <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = cb <EOL> expect ( self . klass . _read_msg ) . args ( <EOL> '<STR_LIT>' , with_consumer_tag = True , with_message_count = False ) . returns ( msg ) <EOL> expect ( cb ) . args ( msg ) <EOL> self . klass . _recv_deliver ( '<STR_LIT>' ) <EOL> def test_recv_deliver_without_cb ( self ) : <EOL> msg = mock ( ) <EOL> msg . delivery_info = { '<STR_LIT>' : '<STR_LIT>' } <EOL> expect ( self . klass . _read_msg ) . args ( <EOL> '<STR_LIT>' , with_consumer_tag = True , with_message_count = False ) . returns ( msg ) <EOL> self . klass . _recv_deliver ( '<STR_LIT>' ) <EOL> def test_get_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( self . klass . default_ticket ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( True ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_get_response ) . returns ( '<STR_LIT>' ) <EOL> assert_equals ( deque ( ) , self . klass . _get_cb ) <EOL> assert_equals ( '<STR_LIT>' , self . klass . get ( '<STR_LIT>' ) ) <EOL> assert_equals ( deque ( [ None ] ) , self . klass . _get_cb ) <EOL> def test_get_with_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_short ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_shortstr ) . args ( '<STR_LIT>' ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_get_response ) . returns ( '<STR_LIT>' ) <EOL> self . klass . _get_cb = deque ( [ '<STR_LIT>' ] ) <EOL> assert_equals ( <EOL> '<STR_LIT>' , self . klass . get ( '<STR_LIT>' , '<STR_LIT>' , no_ack = '<STR_LIT>' , ticket = '<STR_LIT>' ) ) <EOL> assert_equals ( deque ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , self . klass . _get_cb ) <EOL> def test_recv_get_response ( self ) : <EOL> frame = mock ( ) <EOL> frame . method_id = <NUM_LIT> <EOL> expect ( self . klass . _recv_get_ok ) . args ( frame ) . returns ( '<STR_LIT>' ) <EOL> assert_equals ( '<STR_LIT>' , self . klass . _recv_get_response ( frame ) ) <EOL> frame . method_id = <NUM_LIT> <EOL> expect ( self . klass . _recv_get_empty ) . args ( frame ) . returns ( '<STR_LIT>' ) <EOL> assert_equals ( '<STR_LIT>' , self . klass . _recv_get_response ( frame ) ) <EOL> def test_recv_get_ok_with_cb ( self ) : <EOL> cb = mock ( ) <EOL> self . klass . _get_cb . append ( cb ) <EOL> self . klass . _get_cb . append ( mock ( ) ) <EOL> expect ( self . klass . _read_msg ) . args ( <EOL> '<STR_LIT>' , with_consumer_tag = False , with_message_count = True ) . returns ( '<STR_LIT>' ) <EOL> expect ( cb ) . args ( '<STR_LIT>' ) <EOL> assert_equals ( '<STR_LIT>' , self . klass . _recv_get_ok ( '<STR_LIT>' ) ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _get_cb ) ) <EOL> assert_false ( cb in self . klass . _get_cb ) <EOL> def test_recv_get_ok_without_cb ( self ) : <EOL> self . klass . _get_cb . append ( None ) <EOL> self . klass . _get_cb . append ( mock ( ) ) <EOL> expect ( self . klass . _read_msg ) . args ( <EOL> '<STR_LIT>' , with_consumer_tag = False , with_message_count = True ) . returns ( '<STR_LIT>' ) <EOL> self . klass . _recv_get_ok ( '<STR_LIT>' ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _get_cb ) ) <EOL> assert_false ( None in self . klass . _get_cb ) <EOL> def test_recv_get_empty_with_cb ( self ) : <EOL> cb = mock ( ) <EOL> self . klass . _get_cb . append ( cb ) <EOL> self . klass . _get_cb . append ( mock ( ) ) <EOL> expect ( cb ) . args ( None ) <EOL> self . klass . _recv_get_empty ( '<STR_LIT>' ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _get_cb ) ) <EOL> assert_false ( cb in self . klass . _get_cb ) <EOL> def test_recv_get_empty_without_cb ( self ) : <EOL> self . klass . _get_cb . append ( None ) <EOL> self . klass . _get_cb . append ( mock ( ) ) <EOL> self . klass . _recv_get_empty ( '<STR_LIT>' ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _get_cb ) ) <EOL> assert_false ( None in self . klass . _get_cb ) <EOL> def test_ack_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_longlong ) . args ( <NUM_LIT> ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . ack ( <NUM_LIT> ) <EOL> def test_ack_with_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_longlong ) . args ( <NUM_LIT> ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . ack ( <NUM_LIT> , multiple = '<STR_LIT>' ) <EOL> def test_reject_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_longlong ) . args ( <NUM_LIT> ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . reject ( <NUM_LIT> ) <EOL> def test_reject_with_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_longlong ) . args ( <NUM_LIT> ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . reject ( <NUM_LIT> , requeue = '<STR_LIT>' ) <EOL> def test_recover_async ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT:100> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> self . klass . recover_async ( ) <EOL> def test_recover_default_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( False ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_recover_ok ) <EOL> self . klass . recover ( ) <EOL> assert_equals ( deque ( [ None ] ) , self . klass . _recover_cb ) <EOL> def test_recover_with_args ( self ) : <EOL> w = mock ( ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . returns ( w ) <EOL> expect ( w . write_bit ) . args ( '<STR_LIT>' ) <EOL> expect ( mock ( basic_class , '<STR_LIT>' ) ) . args ( <EOL> <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , w ) . returns ( '<STR_LIT>' ) <EOL> expect ( self . klass . send_frame ) . args ( '<STR_LIT>' ) <EOL> expect ( self . klass . channel . add_synchronous_cb ) . args ( <EOL> self . klass . _recv_recover_ok ) <EOL> self . klass . _recover_cb = deque ( [ '<STR_LIT>' ] ) <EOL> self . klass . recover ( requeue = '<STR_LIT>' , cb = '<STR_LIT>' ) <EOL> assert_equals ( deque ( [ '<STR_LIT>' , '<STR_LIT>' ] ) , self . klass . _recover_cb ) <EOL> def test_recv_recover_ok_with_cb ( self ) : <EOL> cb = mock ( ) <EOL> self . klass . _recover_cb . append ( cb ) <EOL> self . klass . _recover_cb . append ( mock ( ) ) <EOL> expect ( cb ) <EOL> self . klass . _recv_recover_ok ( '<STR_LIT>' ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _recover_cb ) ) <EOL> assert_false ( cb in self . klass . _recover_cb ) <EOL> def test_recv_recover_ok_without_cb ( self ) : <EOL> self . klass . _recover_cb . append ( None ) <EOL> self . klass . _recover_cb . append ( mock ( ) ) <EOL> self . klass . _recv_recover_ok ( '<STR_LIT>' ) <EOL> assert_equals ( <NUM_LIT:1> , len ( self . klass . _recover_cb ) ) <EOL> assert_false ( None in self . klass . _recover_cb ) <EOL> def test_read_msg_raises_frameunderflow_when_no_header_frame ( self ) : <EOL> expect ( self . klass . channel . next_frame ) . returns ( None ) <EOL> expect ( self . klass . channel . requeue_frames ) . args ( [ '<STR_LIT>' ] ) <EOL> assert_raises ( <EOL> self . klass . FrameUnderflow , self . klass . _read_msg , '<STR_LIT>' ) <EOL> def test_read_msg_raises_frameunderflow_when_no_content_frames ( self ) : <EOL> header_frame = mock ( ) <EOL> header_frame . size = <NUM_LIT> <EOL> expect ( self . klass . channel . next_frame ) . returns ( header_frame ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( None ) <EOL> expect ( self . klass . channel . requeue_frames ) . args ( <EOL> deque ( [ header_frame , '<STR_LIT>' ] ) ) <EOL> assert_raises ( <EOL> self . klass . FrameUnderflow , self . klass . _read_msg , '<STR_LIT>' ) <EOL> def test_read_msg_when_body_length_0_no_cb ( self ) : <EOL> method_frame = mock ( ) <EOL> header_frame = mock ( ) <EOL> header_frame . size = <NUM_LIT:0> <EOL> header_frame . properties = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> delivery_info = { '<STR_LIT>' : self . klass . channel , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:9> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> expect ( self . klass . channel . next_frame ) . returns ( header_frame ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_longlong ) . returns ( <NUM_LIT:9> ) <EOL> expect ( method_frame . args . read_bit ) . returns ( False ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( Message ) . args ( <EOL> body = bytearray ( ) , delivery_info = delivery_info , foo = '<STR_LIT:bar>' ) . returns ( '<STR_LIT:message>' ) <EOL> assert_equals ( '<STR_LIT:message>' , self . klass . _read_msg ( <EOL> method_frame , with_consumer_tag = True ) ) <EOL> def test_read_msg_when_body_length_greater_than_0_with_cb ( self ) : <EOL> method_frame = mock ( ) <EOL> header_frame = mock ( ) <EOL> header_frame . size = <NUM_LIT:100> <EOL> header_frame . properties = { } <EOL> cframe1 = mock ( ) <EOL> cframe2 = mock ( ) <EOL> self . klass . _consumer_cb [ '<STR_LIT>' ] = mock ( ) <EOL> delivery_info = { <EOL> '<STR_LIT>' : self . klass . channel , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> } <EOL> expect ( self . klass . channel . next_frame ) . returns ( header_frame ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( cframe1 ) <EOL> expect ( cframe1 . payload . buffer ) . returns ( '<STR_LIT:x>' * <NUM_LIT:50> ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( cframe2 ) <EOL> expect ( cframe2 . payload . buffer ) . returns ( '<STR_LIT:x>' * <NUM_LIT:50> ) <EOL> expect ( method_frame . args . read_longlong ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_bit ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_long ) . returns ( <NUM_LIT> ) <EOL> expect ( Message ) . args ( <EOL> body = bytearray ( '<STR_LIT:x>' * <NUM_LIT:100> ) , delivery_info = delivery_info ) . returns ( '<STR_LIT:message>' ) <EOL> assert_equals ( '<STR_LIT:message>' , self . klass . _read_msg ( <EOL> method_frame , with_message_count = True ) ) <EOL> def test_read_returned_msg_raises_frameunderflow ( self ) : <EOL> expect ( self . klass . channel . next_frame ) . returns ( None ) <EOL> expect ( self . klass . channel . requeue_frames ) . args ( [ '<STR_LIT>' ] ) <EOL> assert_raises ( <EOL> self . klass . FrameUnderflow , self . klass . _read_returned_msg , <EOL> '<STR_LIT>' ) <EOL> def test_read_returned_msg ( self ) : <EOL> method_frame = mock ( ) <EOL> header_frame = mock ( ) <EOL> header_frame . properties = { } <EOL> return_info = { <EOL> '<STR_LIT>' : self . klass . channel , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> expect ( self . klass . _reap_msg_frames ) . args ( method_frame ) . returns ( <EOL> ( header_frame , bytearray ( '<STR_LIT:x>' * <NUM_LIT:100> ) ) ) <EOL> expect ( method_frame . args . read_short ) . returns ( <NUM_LIT> ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( method_frame . args . read_shortstr ) . returns ( '<STR_LIT>' ) <EOL> expect ( Message ) . args ( <EOL> body = bytearray ( '<STR_LIT:x>' * <NUM_LIT:100> ) , <EOL> return_info = return_info ) . returns ( '<STR_LIT:message>' ) <EOL> assert_equals ( '<STR_LIT:message>' , self . klass . _read_returned_msg ( method_frame ) ) <EOL> def test_reap_msg_frames_raises_frameunderflow_when_no_header_frame ( self ) : <EOL> expect ( self . klass . channel . next_frame ) . returns ( None ) <EOL> expect ( self . klass . channel . requeue_frames ) . args ( [ '<STR_LIT>' ] ) <EOL> assert_raises ( <EOL> self . klass . FrameUnderflow , self . klass . _reap_msg_frames , <EOL> '<STR_LIT>' ) <EOL> def test_reap_msg_frames_raises_frameunderflow_when_no_content_frames ( self ) : <EOL> header_frame = mock ( ) <EOL> header_frame . size = <NUM_LIT> <EOL> expect ( self . klass . channel . next_frame ) . returns ( header_frame ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( None ) <EOL> expect ( self . klass . channel . requeue_frames ) . args ( <EOL> deque ( [ header_frame , '<STR_LIT>' ] ) ) <EOL> assert_raises ( <EOL> self . klass . FrameUnderflow , self . klass . _reap_msg_frames , <EOL> '<STR_LIT>' ) <EOL> def test_reap_msg_frames_when_body_length_0 ( self ) : <EOL> method_frame = mock ( ) <EOL> header_frame = mock ( ) <EOL> header_frame . size = <NUM_LIT:0> <EOL> header_frame . properties = { '<STR_LIT:foo>' : '<STR_LIT:bar>' } <EOL> expect ( self . klass . channel . next_frame ) . returns ( header_frame ) <EOL> assert_equals ( ( header_frame , bytearray ( ) ) , self . klass . _reap_msg_frames ( <EOL> method_frame ) ) <EOL> def test_reap_msg_frames_when_body_length_greater_than_0 ( self ) : <EOL> method_frame = mock ( ) <EOL> header_frame = mock ( ) <EOL> header_frame . size = <NUM_LIT:100> <EOL> header_frame . properties = { } <EOL> cframe1 = mock ( ) <EOL> cframe2 = mock ( ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( header_frame ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( cframe1 ) <EOL> expect ( cframe1 . payload . buffer ) . returns ( '<STR_LIT:x>' * <NUM_LIT:50> ) <EOL> expect ( self . klass . channel . next_frame ) . returns ( cframe2 ) <EOL> expect ( cframe2 . payload . buffer ) . returns ( '<STR_LIT:x>' * <NUM_LIT:50> ) <EOL> assert_equals ( ( header_frame , '<STR_LIT:x>' * <NUM_LIT:100> ) , self . klass . _reap_msg_frames ( <EOL> method_frame ) ) </s>
