#NEWLINE# def test_constructor_ignores_autoconnect( self ) : #NEWLINE# #INDENT# from gcloud._testing import _Monkey #NEWLINE# from gcloud.bigtable.happybase.connection import Connection #NEWLINE# from gcloud.bigtable.happybase import pool as MUT #NEWLINE# class ConnectionWithOpen ( Connection ) : #NEWLINE# #INDENT# _open_called = False #NEWLINE# def open( self ) : #NEWLINE# #INDENT# self . _open_called = True #NEWLINE# #UNINDENT# #UNINDENT# cluster_copy1 = _Cluster ( ) #NEWLINE# cluster_copy2 = _Cluster ( ) #NEWLINE# cluster_copy3 = _Cluster ( ) #NEWLINE# cluster = _Cluster ( copies = [ cluster_copy1 , cluster_copy2 , cluster_copy3 ] ) #NEWLINE# connection = ConnectionWithOpen ( autoconnect = False , cluster = cluster ) #NEWLINE# self . assertFalse ( connection . _open_called ) #NEWLINE# self . assertTrue ( ( connection . _cluster is cluster_copy1 ) ) #NEWLINE# connection = ConnectionWithOpen ( autoconnect = True , cluster = cluster ) #NEWLINE# self . assertTrue ( connection . _open_called ) #NEWLINE# self . assertTrue ( ( connection . _cluster is cluster_copy2 ) ) #NEWLINE# size = 1 #NEWLINE# with _Monkey ( MUT , Connection = ConnectionWithOpen ) : #NEWLINE# #INDENT# pool = self . _makeOne ( size , autoconnect = True , cluster = cluster ) #NEWLINE# #UNINDENT# for connection in cluster_copy3 . _queue . queue : #NEWLINE# #INDENT# self . assertTrue ( isinstance ( connection , ConnectionWithOpen ) ) #NEWLINE# self . assertTrue ( ( connection . _cluster is cluster_copy3 ) ) #NEWLINE# self . assertFalse ( connection . _open_called )