<s> import pycurl <EOL> import unittest <EOL> from . import appmanager <EOL> from . import util <EOL> setup_module , teardown_module = appmanager . setup ( ( '<STR_LIT>' , <NUM_LIT> ) ) <EOL> class DebugTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . curl = pycurl . Curl ( ) <EOL> self . debug_entries = [ ] <EOL> def tearDown ( self ) : <EOL> self . curl . close ( ) <EOL> def debug_function ( self , t , b ) : <EOL> self . debug_entries . append ( ( t , b ) ) <EOL> def test_perform_get_with_debug_function ( self ) : <EOL> self . curl . setopt ( pycurl . VERBOSE , <NUM_LIT:1> ) <EOL> self . curl . setopt ( pycurl . DEBUGFUNCTION , self . debug_function ) <EOL> self . curl . setopt ( pycurl . URL , '<STR_LIT>' ) <EOL> sio = util . StringIO ( ) <EOL> self . curl . setopt ( pycurl . WRITEFUNCTION , sio . write ) <EOL> self . curl . perform ( ) <EOL> self . check ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> if util . pycurl_version_less_than ( <NUM_LIT:7> , <NUM_LIT> ) : <EOL> self . check ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> else : <EOL> self . check ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> self . check ( <NUM_LIT:0> , '<STR_LIT>' ) <EOL> self . check ( <NUM_LIT:2> , '<STR_LIT>' ) <EOL> self . check ( <NUM_LIT:1> , '<STR_LIT>' ) <EOL> self . check ( <NUM_LIT:1> , '<STR_LIT>' ) <EOL> self . check ( <NUM_LIT:3> , '<STR_LIT:success>' ) <EOL> def check ( self , wanted_t , wanted_b ) : <EOL> for t , b in self . debug_entries : <EOL> if t == wanted_t and wanted_b in b : <EOL> return <EOL> assert False , "<STR_LIT>" % ( wanted_t , wanted_b , repr ( self . debug_entries ) ) </s>
