<s> from pyvows import Vows , expect <EOL> from dopplr . solr . query . dismax import DisMax <EOL> @ Vows . batch <EOL> class WithTheDisMax ( Vows . Context ) : <EOL> class WithDefaultParams ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> q = DisMax ( '<STR_LIT>' , edismax = False ) <EOL> return q . get_params ( ) <EOL> def theDefTypeMustMatch ( self , topic ) : <EOL> expect ( topic ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def theQueryFieldsMatch ( self , topic ) : <EOL> expect ( topic ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def noUnexpectedArgs ( self , topic ) : <EOL> expect ( topic ) . to_length ( <NUM_LIT:2> ) <EOL> class WithOptionalParameters ( WithDefaultParams ) : <EOL> def topic ( self ) : <EOL> valid_params = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> for v in valid_params : <EOL> kwargs = { v : '<STR_LIT:a>' } <EOL> q = DisMax ( '<STR_LIT>' , edismax = False , ** kwargs ) <EOL> yield ( v , q . get_params ( ) ) <EOL> def theDefTypeMustMatch ( self , ( field , params ) ) : <EOL> expect ( params ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def theQueryFieldsMatch ( self , ( field , params ) ) : <EOL> expect ( params ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def noUnexpectedArgs ( self , ( field , params ) ) : <EOL> expect ( params ) . to_length ( <NUM_LIT:3> ) <EOL> def theQueryMustMatch ( self , ( field , params ) ) : <EOL> if field == '<STR_LIT>' : <EOL> field = '<STR_LIT>' <EOL> expect ( params ) . to_include ( ( field , '<STR_LIT:a>' ) ) <EOL> @ Vows . batch <EOL> class WithTheEDisMax ( Vows . Context ) : <EOL> class WithDefaultParams ( Vows . Context ) : <EOL> def topic ( self ) : <EOL> q = DisMax ( '<STR_LIT>' ) <EOL> return q . get_params ( ) <EOL> def theDefTypeMustMatch ( self , topic ) : <EOL> expect ( topic ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def theQueryFieldsMatch ( self , topic ) : <EOL> expect ( topic ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def noUnexpectedArgs ( self , topic ) : <EOL> expect ( topic ) . to_length ( <NUM_LIT:2> ) <EOL> class WithOptionalParameters ( WithDefaultParams ) : <EOL> def topic ( self ) : <EOL> valid_params = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> for v in valid_params : <EOL> kwargs = { v : '<STR_LIT:a>' } <EOL> q = DisMax ( '<STR_LIT>' , ** kwargs ) <EOL> yield ( v , q . get_params ( ) ) <EOL> def theDefTypeMustMatch ( self , ( field , params ) ) : <EOL> expect ( params ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def theQueryFieldsMatch ( self , ( field , params ) ) : <EOL> expect ( params ) . to_include ( ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def noUnexpectedArgs ( self , ( field , params ) ) : <EOL> expect ( params ) . to_length ( <NUM_LIT:3> ) <EOL> def theQueryMustMatch ( self , ( field , params ) ) : <EOL> if field == '<STR_LIT>' : <EOL> field = '<STR_LIT>' <EOL> expect ( params ) . to_include ( ( field , '<STR_LIT:a>' ) ) </s>
