#NEWLINE# def test_qmark( ) : #NEWLINE# #INDENT# dt ( 'select * from test where int = 1' , 'select * from test where int = ?' , [ 1 ] ) #NEWLINE# dt ( "select * from test where str = 'foo'" , 'select * from test where str = ?' , [ 'foo' ] ) #NEWLINE# dt ( 'select * from test where flt = 0.123' , 'select * from test where flt = ?' , [ 0.123 ] ) #NEWLINE# dt ( 'select * from test where nul = NULL' , 'select * from test where nul = ?' , [ None ] ) #NEWLINE# dt ( ( "select * from test where int = 1 and str = 'foo' and " + 'flt = 0.123 and nul = NULL' ) , ( 'select * from test where int = ? and str = ' + '? and flt = ? and nul = ?' ) , [ 1 , 'foo' , 0.123 , None ] ) #NEWLINE# dt ( ( "select * from test where int=1 and str='foo' and " + 'flt=(0.123) and nul=NULL' ) , ( 'select * from test where int=? and str=' + '? and flt=(?) and nul=?' ) , [ 1 , 'foo' , 0.123 , None ] ) #NEWLINE# dt ( ( "select * from test where int=1 and str='foo' and " + 'flt=0.123 and nul=NULL' ) , ( 'select * from test where int=? and str=' + '? and flt=? and nul=?' ) , ( 1 , 'foo' , 0.123 , None ) ) #NEWLINE# bad_bindings = [ ( 'select * from test where int = ?' , [ ] ) , ( 'select * from test where int = ? or int = ?' , [ 1 ] ) , ( 'select * from test where int = ?' , [ 1 , 2 ] ) , ( 'select * from test where int = ? or int = ? or int = ?' , [ 1 , 2 , 3 , 4 ] ) ] #NEWLINE# for q in bad_bindings : #NEWLINE# #INDENT# with raises ( ProgrammingError ) : #NEWLINE# #INDENT# dt ( 'should have raised exception' , q [ 0 ] , q [ 1 ] )