<s> import os . path <EOL> import pycurl <EOL> import sys <EOL> import unittest <EOL> class WriteAbortTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . curl = pycurl . Curl ( ) <EOL> def tearDown ( self ) : <EOL> self . curl . close ( ) <EOL> def test_write_abort ( self ) : <EOL> def write_cb ( _ ) : <EOL> return - <NUM_LIT:1> <EOL> self . curl . setopt ( pycurl . URL , '<STR_LIT>' + os . path . abspath ( sys . argv [ <NUM_LIT:0> ] ) ) <EOL> self . curl . setopt ( pycurl . WRITEFUNCTION , write_cb ) <EOL> try : <EOL> self . curl . perform ( ) <EOL> except pycurl . error : <EOL> err , msg = sys . exc_info ( ) [ <NUM_LIT:1> ] <EOL> assert pycurl . E_WRITE_ERROR == err <EOL> assert not hasattr ( sys , '<STR_LIT>' ) </s>
