def test_chunked_upload():
 close_server = threading.Event()
 server = Server.basic_response_server(wait_to_close_event=close_server)
 data = iter(['a', 'b', 'c'])
 with server as (host, port):
  url = 'http://{0}:{1}/'.format(host, port)
  r = requests.post(url, data=data, stream=True)
  close_server.set()
 assert (r.status_code == 200)
 assert (r.request.headers['Transfer-Encoding'] == 'chunked')

def test_chunked_upload ( ) : close_server = threading . Event ( ) server = Server . basic_response_server ( wait_to_close_event = close_server ) data = iter ( [ 'a' , 'b' , 'c' ] ) with server as ( host , port ) : url = 'http://{0}:{1}/' . format ( host , port ) r = requests . post ( url , data = data , stream = True ) close_server . set ( ) assert ( r . status_code == 200 ) assert ( r . request . headers [ 'Transfer-Encoding' ] == 'chunked' )
can safely send generators .