<s> from mock import Mock , patch <EOL> import cmemcached <EOL> INVALID_SERVER_ADDR = '<STR_LIT>' <EOL> def test_sys_stderr_should_have_no_output_when_no_logger_is_set ( memcached ) : <EOL> mc = cmemcached . Client ( [ memcached ] ) <EOL> with patch ( '<STR_LIT>' ) as mock_stderr : <EOL> mc . get ( '<STR_LIT>' ) <EOL> mc . set ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert not mock_stderr . write . called <EOL> def test_logger_should_be_called_when_set ( ) : <EOL> logger = Mock ( ) <EOL> client = cmemcached . Client ( [ INVALID_SERVER_ADDR ] , logger = logger ) <EOL> client . get ( '<STR_LIT>' ) <EOL> client . set ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> logger . assert_called_with ( <EOL> "<STR_LIT>" % <EOL> INVALID_SERVER_ADDR ) </s>
