#NEWLINE# def test_identifier_in_postgresql( ) : #NEWLINE# #INDENT# mosql . std . patch ( ) #NEWLINE# conn = connect_to_postgresql ( ) #NEWLINE# cur = conn . cursor ( ) #NEWLINE# expected_text = '' . join ( ( unichr ( i ) for i in xrange ( 1 , 55296 ) ) ) #NEWLINE# expected_text += '' . join ( ( unichr ( i ) for i in xrange ( 57344 , ( 65535 + 1 ) ) ) ) #NEWLINE# for sliced_expected_text in gen_slice_for_postgresql ( expected_text ) : #NEWLINE# #INDENT# if ( randrange ( DENO ) != 0 ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# cur . execute ( '\n            create temporary table _test_identifier_in_postgresql (\n                {} varchar(128) primary key\n            )\n        ' . format ( make_identifier ( sliced_expected_text ) ) ) #NEWLINE# cur . execute ( "\n            select\n                column_name\n            from\n                information_schema.columns\n            where\n                table_name = '_test_identifier_in_postgresql'\n        " ) #NEWLINE# ( fetched_bytes , ) = cur . fetchone ( ) #NEWLINE# fetched_text = fetched_bytes . decode ( 'utf-8' ) #NEWLINE# assert ( fetched_text == sliced_expected_text ) #NEWLINE# conn . rollback ( ) #NEWLINE# #UNINDENT# ascii_chars = [ unichr ( i ) for i in xrange ( 1 , ( 127 + 1 ) ) ] #NEWLINE# expected_text = '' . join ( ( ( a + b ) for ( a , b ) in product ( ascii_chars , ascii_chars ) ) ) #NEWLINE# for sliced_expected_text in gen_slice_for_postgresql ( expected_text ) : #NEWLINE# #INDENT# if ( randrange ( DENO ) != 0 ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# cur . execute ( '\n            create temporary table _test_identifier_in_postgresql (\n                {} varchar(128) primary key\n            )\n        ' . format ( make_identifier ( fetched_bytes ) ) ) #NEWLINE# cur . execute ( "\n            select\n                column_name\n            from\n                information_schema.columns\n            where\n                table_name = '_test_identifier_in_postgresql'\n        " ) #NEWLINE# ( fetched_bytes , ) = cur . fetchone ( ) #NEWLINE# fetched_text = fetched_bytes . decode ( 'utf-8' ) #NEWLINE# assert ( fetched_text == sliced_expected_text ) #NEWLINE# conn . rollback ( ) #NEWLINE# #UNINDENT# cur . close ( ) #NEWLINE# conn . close ( )