@@ -1500,28 +1500,38 @@ def test_auth_token(self):
1500
1500
"my-token" )
1501
1501
1502
1502
def test_custom_socket_options (self ):
1503
- test_socket_options = HTTPConnection .default_socket_options + [(socket .SOL_SOCKET , socket .SO_KEEPALIVE , 1 ),
1504
- (socket .IPPROTO_TCP , socket .TCP_KEEPINTVL , 60 ),
1505
- (socket .IPPROTO_TCP , socket .TCP_KEEPCNT , 15 )]
1503
+ """Test custom socket options."""
1504
+ test_socket_options = HTTPConnection .default_socket_options + \
1505
+ [(socket .SOL_SOCKET , socket .SO_KEEPALIVE , 1 ),
1506
+ (socket .IPPROTO_TCP , socket .TCP_KEEPINTVL , 60 ),
1507
+ (socket .IPPROTO_TCP , socket .TCP_KEEPCNT , 15 )]
1506
1508
1507
- cli = InfluxDBClient (username = None , password = None , socket_options = test_socket_options )
1509
+ cli = InfluxDBClient (username = None , password = None ,
1510
+ socket_options = test_socket_options )
1508
1511
1509
- self .assertEquals (cli ._session .adapters .get ("http://" ).socket_options , test_socket_options )
1510
- self .assertEquals (cli ._session .adapters .get ("http://" ).poolmanager .connection_pool_kw .get ("socket_options" ),
1512
+ self .assertEquals (cli ._session .adapters .get ("http://" ).socket_options ,
1513
+ test_socket_options )
1514
+ self .assertEquals (cli ._session .adapters .get ("http://" ).poolmanager .
1515
+ connection_pool_kw .get ("socket_options" ),
1511
1516
test_socket_options )
1512
1517
1513
- connection_pool = cli ._session .adapters .get ("http://" ).poolmanager .connection_from_url (
1518
+ connection_pool = cli ._session .adapters .get ("http://" ).poolmanager \
1519
+ .connection_from_url (
1514
1520
url = "http://localhost:8086" )
1515
1521
new_connection = connection_pool ._new_conn ()
1516
1522
self .assertEquals (new_connection .socket_options , test_socket_options )
1517
1523
1518
1524
def test_none_socket_options (self ):
1525
+ """Test default socket options."""
1519
1526
cli = InfluxDBClient (username = None , password = None )
1520
- self .assertEquals (cli ._session .adapters .get ("http://" ).socket_options , None )
1521
- connection_pool = cli ._session .adapters .get ("http://" ).poolmanager .connection_from_url (
1527
+ self .assertEquals (cli ._session .adapters .get ("http://" ).socket_options ,
1528
+ None )
1529
+ connection_pool = cli ._session .adapters .get ("http://" ).poolmanager \
1530
+ .connection_from_url (
1522
1531
url = "http://localhost:8086" )
1523
1532
new_connection = connection_pool ._new_conn ()
1524
- self .assertEquals (new_connection .socket_options , HTTPConnection .default_socket_options )
1533
+ self .assertEquals (new_connection .socket_options ,
1534
+ HTTPConnection .default_socket_options )
1525
1535
1526
1536
1527
1537
class FakeClient (InfluxDBClient ):
0 commit comments