<s> from gaffer . message import ( Message , decode_frame , make_response , <EOL> FRAME_ERROR_TYPE , FRAME_RESPONSE_TYPE , FRAME_MESSAGE_TYPE , MAGIC_V1 ) <EOL> def test_encode ( ) : <EOL> m = Message ( b"<STR_LIT:test>" , id = b"<STR_LIT>" ) <EOL> assert m . body == b"<STR_LIT:test>" <EOL> assert m . id == b"<STR_LIT>" <EOL> assert m . type == FRAME_MESSAGE_TYPE <EOL> assert str ( m ) == "<STR_LIT>" <EOL> assert m . encode ( ) == b"<STR_LIT>" <EOL> def test_decode ( ) : <EOL> m = decode_frame ( b"<STR_LIT>" ) <EOL> assert isinstance ( m , Message ) <EOL> assert m . id == b"<STR_LIT>" <EOL> assert m . type == FRAME_MESSAGE_TYPE <EOL> assert m . body == b"<STR_LIT:test>" <EOL> def test_response ( ) : <EOL> m = make_response ( "<STR_LIT:test>" , id = "<STR_LIT>" ) <EOL> assert isinstance ( m , Message ) <EOL> assert m . id == b"<STR_LIT>" <EOL> assert m . type == FRAME_RESPONSE_TYPE <EOL> assert m . body == b"<STR_LIT:test>" <EOL> assert m . encode ( ) == b"<STR_LIT>" </s>
