<s> from mock import Mock <EOL> import pytest <EOL> from requests . sessions import Session <EOL> from bravado . requests_client import RequestsFutureAdapter <EOL> @ pytest . fixture <EOL> def request ( ) : <EOL> return dict ( url = '<STR_LIT>' ) <EOL> @ pytest . fixture <EOL> def session ( ) : <EOL> return Mock ( spec = Session ) <EOL> def test_no_timeouts ( session , request ) : <EOL> misc_options = { } <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = None ) is None <EOL> def test_service_timeout_and_result_timeout_None ( session , request ) : <EOL> misc_options = dict ( timeout = <NUM_LIT:1> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = None ) == <NUM_LIT:1> <EOL> def test_no_service_timeout_and_result_timeout_not_None ( session , request ) : <EOL> misc_options = { } <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = <NUM_LIT:1> ) == <NUM_LIT:1> <EOL> def test_service_timeout_lt_result_timeout ( session , request ) : <EOL> misc_options = dict ( timeout = <NUM_LIT:10> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = <NUM_LIT:11> ) == <NUM_LIT:11> <EOL> def test_service_timeout_gt_result_timeout ( session , request ) : <EOL> misc_options = dict ( timeout = <NUM_LIT:11> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = <NUM_LIT:10> ) == <NUM_LIT:11> <EOL> def test_service_timeout_None_result_timeout_not_None ( session , request ) : <EOL> misc_options = dict ( timeout = None ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = <NUM_LIT:10> ) == <NUM_LIT:10> <EOL> def test_service_timeout_not_None_result_timeout_None ( session , request ) : <EOL> misc_options = dict ( timeout = <NUM_LIT:10> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = None ) == <NUM_LIT:10> <EOL> def test_both_timeouts_the_same ( session , request ) : <EOL> misc_options = dict ( timeout = <NUM_LIT:10> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = <NUM_LIT:10> ) == <NUM_LIT:10> <EOL> def test_connect_timeout_and_idle_timeout ( session , request ) : <EOL> misc_options = dict ( connect_timeout = <NUM_LIT:1> , timeout = <NUM_LIT:11> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = None ) == ( <NUM_LIT:1> , <NUM_LIT:11> ) <EOL> def test_connect_timeout_only ( session , request ) : <EOL> misc_options = dict ( connect_timeout = <NUM_LIT:1> ) <EOL> future = RequestsFutureAdapter ( session , request , misc_options ) <EOL> assert future . build_timeout ( result_timeout = None ) == ( <NUM_LIT:1> , None ) </s>
