<s> """<STR_LIT>""" <EOL> from __future__ import ( absolute_import , division , <EOL> print_function , unicode_literals ) <EOL> from future . builtins import * <EOL> from future import utils <EOL> from future . tests . base import unittest , skip26 <EOL> from future . backports . http import client <EOL> from future . backports . test import support <EOL> import array <EOL> import io <EOL> import socket <EOL> import errno <EOL> import sys <EOL> TestCase = unittest . TestCase <EOL> HOST = support . HOST <EOL> class FakeSocket ( object ) : <EOL> def __init__ ( self , text , fileclass = io . BytesIO ) : <EOL> if isinstance ( text , str ) : <EOL> text = str ( text ) . encode ( '<STR_LIT:ascii>' ) <EOL> self . text = text <EOL> self . fileclass = fileclass <EOL> self . data = bytes ( b'<STR_LIT>' ) <EOL> def sendall ( self , data ) : <EOL> olddata = self . data <EOL> assert isinstance ( olddata , bytes ) <EOL> if utils . PY3 : <EOL> self . data += data <EOL> else : <EOL> if isinstance ( data , type ( u'<STR_LIT>' ) ) : <EOL> newdata = data . encode ( '<STR_LIT:ascii>' ) <EOL> elif isinstance ( data , type ( b'<STR_LIT>' ) ) : <EOL> newdata = bytes ( data ) <EOL> elif isinstance ( data , bytes ) : <EOL> newdata = data <EOL> elif isinstance ( data , array . array ) : <EOL> newdata = data . tostring ( ) <EOL> else : <EOL> newdata = bytes ( b'<STR_LIT>' ) . join ( chr ( d ) for d in bytes ( data ) ) <EOL> self . data += newdata <EOL> def makefile ( self , mode , bufsize = None ) : <EOL> if mode != '<STR_LIT:r>' and mode != '<STR_LIT:rb>' : <EOL> raise client . UnimplementedFileMode ( ) <EOL> return self . fileclass ( self . text ) <EOL> class EPipeSocket ( FakeSocket ) : <EOL> def __init__ ( self , text , pipe_trigger ) : <EOL> FakeSocket . __init__ ( self , text ) <EOL> self . pipe_trigger = pipe_trigger <EOL> def sendall ( self , data ) : <EOL> if self . pipe_trigger in data : <EOL> raise socket . error ( errno . EPIPE , "<STR_LIT>" ) <EOL> self . data += data <EOL> def close ( self ) : <EOL> pass <EOL> class NoEOFBytesIO ( io . BytesIO ) : <EOL> """<STR_LIT>""" <EOL> def read ( self , n = - <NUM_LIT:1> ) : <EOL> data = io . BytesIO . read ( self , n ) <EOL> if data == b'<STR_LIT>' : <EOL> raise AssertionError ( '<STR_LIT>' ) <EOL> return data <EOL> def readline ( self , length = None ) : <EOL> data = io . BytesIO . readline ( self , length ) <EOL> if data == b'<STR_LIT>' : <EOL> raise AssertionError ( '<STR_LIT>' ) <EOL> return data <EOL> @ skip26 <EOL> class HeaderTests ( TestCase ) : <EOL> def test_auto_headers ( self ) : <EOL> class HeaderCountingBuffer ( list ) : <EOL> def __init__ ( self ) : <EOL> self . count = { } <EOL> def append ( self , item ) : <EOL> kv = item . split ( b'<STR_LIT::>' ) <EOL> if len ( kv ) > <NUM_LIT:1> : <EOL> lcKey = kv [ <NUM_LIT:0> ] . decode ( '<STR_LIT:ascii>' ) . lower ( ) <EOL> self . count . setdefault ( lcKey , <NUM_LIT:0> ) <EOL> self . count [ lcKey ] += <NUM_LIT:1> <EOL> list . append ( self , item ) <EOL> for explicit_header in True , False : <EOL> for header in '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' : <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> conn . sock = FakeSocket ( '<STR_LIT>' ) <EOL> conn . _buffer = HeaderCountingBuffer ( ) <EOL> body = '<STR_LIT>' <EOL> headers = { } <EOL> if explicit_header : <EOL> headers [ header ] = str ( len ( body ) ) <EOL> conn . request ( '<STR_LIT:POST>' , '<STR_LIT:/>' , body , headers ) <EOL> self . assertEqual ( conn . _buffer . count [ header . lower ( ) ] , <NUM_LIT:1> ) <EOL> def test_content_length_0 ( self ) : <EOL> class ContentLengthChecker ( list ) : <EOL> def __init__ ( self ) : <EOL> list . __init__ ( self ) <EOL> self . content_length = None <EOL> def append ( self , item ) : <EOL> kv = item . split ( b'<STR_LIT::>' , <NUM_LIT:1> ) <EOL> if len ( kv ) > <NUM_LIT:1> and kv [ <NUM_LIT:0> ] . lower ( ) == b'<STR_LIT>' : <EOL> self . content_length = kv [ <NUM_LIT:1> ] . strip ( ) <EOL> list . append ( self , item ) <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> conn . sock = FakeSocket ( None ) <EOL> conn . _buffer = ContentLengthChecker ( ) <EOL> conn . request ( '<STR_LIT:POST>' , '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> self . assertEqual ( conn . _buffer . content_length , b'<STR_LIT:0>' , <EOL> '<STR_LIT>' ) <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> conn . sock = FakeSocket ( None ) <EOL> conn . _buffer = ContentLengthChecker ( ) <EOL> conn . request ( '<STR_LIT>' , '<STR_LIT:/>' , '<STR_LIT>' ) <EOL> self . assertEqual ( conn . _buffer . content_length , b'<STR_LIT:0>' , <EOL> '<STR_LIT>' ) <EOL> def test_putheader ( self ) : <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> conn . sock = FakeSocket ( None ) <EOL> conn . putrequest ( '<STR_LIT:GET>' , '<STR_LIT:/>' ) <EOL> conn . putheader ( '<STR_LIT>' , <NUM_LIT> ) <EOL> self . assertTrue ( b'<STR_LIT>' in conn . _buffer ) <EOL> def test_ipv6host_header ( self ) : <EOL> expected = bytes ( b'<STR_LIT>' ) + bytes ( b'<STR_LIT>' ) <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> sock = FakeSocket ( '<STR_LIT>' ) <EOL> conn . sock = sock <EOL> conn . request ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> self . assertTrue ( sock . data . startswith ( expected ) ) <EOL> expected = bytes ( b'<STR_LIT>' ) + bytes ( b'<STR_LIT>' ) <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> sock = FakeSocket ( '<STR_LIT>' ) <EOL> conn . sock = sock <EOL> conn . request ( '<STR_LIT:GET>' , '<STR_LIT>' ) <EOL> self . assertTrue ( sock . data . startswith ( expected ) ) <EOL> @ skip26 <EOL> class BasicTest ( TestCase ) : <EOL> def test_status_lines ( self ) : <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( ) , b'<STR_LIT>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> self . assertRaises ( client . BadStatusLine , resp . begin ) <EOL> def test_bad_status_repr ( self ) : <EOL> exc = client . BadStatusLine ( '<STR_LIT>' ) <EOL> if not utils . PY3 : <EOL> self . assertEqual ( repr ( exc ) , '''<STR_LIT>''' ) <EOL> else : <EOL> self . assertEqual ( repr ( exc ) , '''<STR_LIT>''' ) <EOL> def test_partial_reads ( self ) : <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:2> ) , b'<STR_LIT>' ) <EOL> self . assertFalse ( resp . isclosed ( ) ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:2> ) , b'<STR_LIT>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> def test_partial_reads_no_content_length ( self ) : <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:2> ) , b'<STR_LIT>' ) <EOL> self . assertFalse ( resp . isclosed ( ) ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:2> ) , b'<STR_LIT>' ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:1> ) , b'<STR_LIT>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> def test_partial_reads_incomplete_body ( self ) : <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:2> ) , b'<STR_LIT>' ) <EOL> self . assertFalse ( resp . isclosed ( ) ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:2> ) , b'<STR_LIT>' ) <EOL> self . assertEqual ( resp . read ( <NUM_LIT:1> ) , b'<STR_LIT>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> def test_host_port ( self ) : <EOL> for hp in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> self . assertRaises ( client . InvalidURL , client . HTTPConnection , hp ) <EOL> for hp , h , p in ( ( "<STR_LIT>" , "<STR_LIT>" , <EOL> <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) ) : <EOL> c = client . HTTPConnection ( hp ) <EOL> self . assertEqual ( h , c . host ) <EOL> self . assertEqual ( p , c . port ) <EOL> def test_response_headers ( self ) : <EOL> text = ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT:\r\n>' <EOL> '<STR_LIT>' ) <EOL> hdr = ( '<STR_LIT>' <EOL> '<STR_LIT:U+002CU+0020>' <EOL> '<STR_LIT>' ) <EOL> s = FakeSocket ( text ) <EOL> r = client . HTTPResponse ( s ) <EOL> r . begin ( ) <EOL> cookies = r . getheader ( "<STR_LIT>" ) <EOL> self . assertEqual ( cookies , hdr ) <EOL> def test_read_head ( self ) : <EOL> sock = FakeSocket ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT:\r\n>' , <EOL> NoEOFBytesIO ) <EOL> resp = client . HTTPResponse ( sock , method = "<STR_LIT>" ) <EOL> resp . begin ( ) <EOL> if resp . read ( ) : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def test_send_file ( self ) : <EOL> expected = ( bytes ( b'<STR_LIT>' ) + <EOL> bytes ( b'<STR_LIT>' ) ) <EOL> with open ( __file__ , '<STR_LIT:rb>' ) as body : <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> sock = FakeSocket ( body ) <EOL> conn . sock = sock <EOL> conn . request ( '<STR_LIT:GET>' , '<STR_LIT>' , body ) <EOL> self . assertTrue ( sock . data . startswith ( expected ) , '<STR_LIT>' % <EOL> ( sock . data [ : len ( expected ) ] , expected ) ) <EOL> def test_send ( self ) : <EOL> expected = bytes ( b'<STR_LIT>' ) <EOL> conn = client . HTTPConnection ( '<STR_LIT>' ) <EOL> sock = FakeSocket ( None ) <EOL> conn . sock = sock <EOL> conn . send ( expected ) <EOL> self . assertEqual ( expected , sock . data ) <EOL> sock . data = bytes ( b'<STR_LIT>' ) <EOL> if utils . PY3 : <EOL> mydata = array . array ( '<STR_LIT:b>' , expected ) <EOL> else : <EOL> mydata = array . array ( b'<STR_LIT:b>' , expected ) <EOL> conn . send ( mydata ) <EOL> self . assertEqual ( expected , sock . data ) <EOL> sock . data = bytes ( b'<STR_LIT>' ) <EOL> conn . send ( io . BytesIO ( expected ) ) <EOL> self . assertEqual ( expected , sock . data ) <EOL> def test_chunked ( self ) : <EOL> chunked_start = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> sock = FakeSocket ( chunked_start + '<STR_LIT>' ) <EOL> resp = client . HTTPResponse ( sock , method = "<STR_LIT:GET>" ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( ) , b'<STR_LIT>' ) <EOL> resp . close ( ) <EOL> for x in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> sock = FakeSocket ( chunked_start + x ) <EOL> resp = client . HTTPResponse ( sock , method = "<STR_LIT:GET>" ) <EOL> resp . begin ( ) <EOL> try : <EOL> resp . read ( ) <EOL> except client . IncompleteRead as i : <EOL> self . assertEqual ( i . partial , b'<STR_LIT>' ) <EOL> self . assertEqual ( repr ( i ) , '<STR_LIT>' ) <EOL> self . assertEqual ( str ( i ) , '<STR_LIT>' ) <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> finally : <EOL> resp . close ( ) <EOL> def test_chunked_head ( self ) : <EOL> chunked_start = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> sock = FakeSocket ( chunked_start + '<STR_LIT>' ) <EOL> resp = client . HTTPResponse ( sock , method = "<STR_LIT>" ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( ) , b'<STR_LIT>' ) <EOL> self . assertEqual ( resp . status , <NUM_LIT:200> ) <EOL> self . assertEqual ( resp . reason , '<STR_LIT:OK>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> def test_negative_content_length ( self ) : <EOL> sock = FakeSocket ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> resp = client . HTTPResponse ( sock , method = "<STR_LIT:GET>" ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( ) , b'<STR_LIT>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> def test_incomplete_read ( self ) : <EOL> sock = FakeSocket ( '<STR_LIT>' ) <EOL> resp = client . HTTPResponse ( sock , method = "<STR_LIT:GET>" ) <EOL> resp . begin ( ) <EOL> try : <EOL> resp . read ( ) <EOL> except client . IncompleteRead as i : <EOL> self . assertEqual ( i . partial , b'<STR_LIT>' ) <EOL> self . assertEqual ( repr ( i ) , <EOL> "<STR_LIT>" ) <EOL> self . assertEqual ( str ( i ) , <EOL> "<STR_LIT>" ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> else : <EOL> self . fail ( '<STR_LIT>' ) <EOL> def test_epipe ( self ) : <EOL> sock = EPipeSocket ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> b"<STR_LIT>" ) <EOL> conn = client . HTTPConnection ( "<STR_LIT>" ) <EOL> conn . sock = sock <EOL> self . assertRaises ( socket . error , <EOL> lambda : conn . request ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:body>" ) ) <EOL> resp = conn . getresponse ( ) <EOL> self . assertEqual ( <NUM_LIT> , resp . status ) <EOL> self . assertEqual ( "<STR_LIT>" , <EOL> resp . getheader ( "<STR_LIT>" ) ) <EOL> def test_filenoattr ( self ) : <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> self . assertTrue ( hasattr ( resp , '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) <EOL> def test_overflowing_status_line ( self ) : <EOL> self . skipTest ( "<STR_LIT>" ) <EOL> body = "<STR_LIT>" + "<STR_LIT:k>" * <NUM_LIT> + "<STR_LIT:\r\n>" <EOL> resp = client . HTTPResponse ( FakeSocket ( body ) ) <EOL> self . assertRaises ( ( client . LineTooLong , client . BadStatusLine ) , resp . begin ) <EOL> def test_overflowing_header_line ( self ) : <EOL> body = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' + '<STR_LIT:r>' * <NUM_LIT> + '<STR_LIT>' <EOL> ) <EOL> resp = client . HTTPResponse ( FakeSocket ( body ) ) <EOL> self . assertRaises ( client . LineTooLong , resp . begin ) <EOL> def test_overflowing_chunked_line ( self ) : <EOL> body = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> + '<STR_LIT:0>' * <NUM_LIT> + '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> resp = client . HTTPResponse ( FakeSocket ( body ) ) <EOL> resp . begin ( ) <EOL> self . assertRaises ( client . LineTooLong , resp . read ) <EOL> def test_early_eof ( self ) : <EOL> body = "<STR_LIT>" <EOL> sock = FakeSocket ( body ) <EOL> resp = client . HTTPResponse ( sock ) <EOL> resp . begin ( ) <EOL> self . assertEqual ( resp . read ( ) , b'<STR_LIT>' ) <EOL> self . assertTrue ( resp . isclosed ( ) ) <EOL> @ skip26 <EOL> class OfflineTest ( TestCase ) : <EOL> def test_responses ( self ) : <EOL> self . assertEqual ( client . responses [ client . NOT_FOUND ] , "<STR_LIT>" ) <EOL> @ skip26 <EOL> class SourceAddressTest ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . serv = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <EOL> self . port = support . bind_port ( self . serv ) <EOL> self . source_port = support . find_unused_port ( ) <EOL> self . serv . listen ( <NUM_LIT:5> ) <EOL> self . conn = None <EOL> def tearDown ( self ) : <EOL> if self . conn : <EOL> self . conn . close ( ) <EOL> self . conn = None <EOL> self . serv . close ( ) <EOL> self . serv = None <EOL> def testHTTPConnectionSourceAddress ( self ) : <EOL> self . conn = client . HTTPConnection ( HOST , self . port , <EOL> source_address = ( '<STR_LIT>' , self . source_port ) ) <EOL> self . conn . connect ( ) <EOL> self . assertEqual ( self . conn . sock . getsockname ( ) [ <NUM_LIT:1> ] , self . source_port ) <EOL> @ unittest . skipIf ( not hasattr ( client , '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) <EOL> def testHTTPSConnectionSourceAddress ( self ) : <EOL> self . conn = client . HTTPSConnection ( HOST , self . port , <EOL> source_address = ( '<STR_LIT>' , self . source_port ) ) <EOL> @ skip26 <EOL> class TimeoutTest ( TestCase ) : <EOL> PORT = None <EOL> def setUp ( self ) : <EOL> self . serv = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) <EOL> TimeoutTest . PORT = support . bind_port ( self . serv ) <EOL> self . serv . listen ( <NUM_LIT:5> ) <EOL> def tearDown ( self ) : <EOL> self . serv . close ( ) <EOL> self . serv = None <EOL> def testTimeoutAttribute ( self ) : <EOL> '''<STR_LIT>''' <EOL> self . assertTrue ( socket . getdefaulttimeout ( ) is None ) <EOL> socket . setdefaulttimeout ( <NUM_LIT:30> ) <EOL> try : <EOL> httpConn = client . HTTPConnection ( HOST , TimeoutTest . PORT ) <EOL> httpConn . connect ( ) <EOL> finally : <EOL> socket . setdefaulttimeout ( None ) <EOL> self . assertEqual ( httpConn . sock . gettimeout ( ) , <NUM_LIT:30> ) <EOL> httpConn . close ( ) <EOL> self . assertTrue ( socket . getdefaulttimeout ( ) is None ) <EOL> socket . setdefaulttimeout ( <NUM_LIT:30> ) <EOL> try : <EOL> httpConn = client . HTTPConnection ( HOST , TimeoutTest . PORT , <EOL> timeout = None ) <EOL> httpConn . connect ( ) <EOL> finally : <EOL> socket . setdefaulttimeout ( None ) <EOL> self . assertEqual ( httpConn . sock . gettimeout ( ) , None ) <EOL> httpConn . close ( ) <EOL> httpConn = client . HTTPConnection ( HOST , TimeoutTest . PORT , timeout = <NUM_LIT:30> ) <EOL> httpConn . connect ( ) <EOL> self . assertEqual ( httpConn . sock . gettimeout ( ) , <NUM_LIT:30> ) <EOL> httpConn . close ( ) <EOL> @ skip26 <EOL> class HTTPSTest ( TestCase ) : <EOL> def test_attributes ( self ) : <EOL> if hasattr ( client , '<STR_LIT>' ) : <EOL> h = client . HTTPSConnection ( HOST , TimeoutTest . PORT , timeout = <NUM_LIT:30> ) <EOL> self . assertEqual ( h . timeout , <NUM_LIT:30> ) <EOL> @ unittest . skipIf ( not hasattr ( client , '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_host_port ( self ) : <EOL> for hp in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> self . assertRaises ( client . InvalidURL , client . HTTPSConnection , hp ) <EOL> for hp , h , p in ( ( "<STR_LIT>" , "<STR_LIT>" , <EOL> <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , <NUM_LIT> ) ) : <EOL> c = client . HTTPSConnection ( hp ) <EOL> self . assertEqual ( h , c . host ) <EOL> self . assertEqual ( p , c . port ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
