<s> import unittest <EOL> from pycast . optimization . baseoptimizationmethod import BaseOptimizationMethod <EOL> from pycast . methods . basemethod import BaseMethod <EOL> from pycast . errors . baseerrormeasure import BaseErrorMeasure <EOL> from pycast . common . timeseries import TimeSeries <EOL> class BaseOptimizationMethodTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def initialization_errormeasure_test ( self ) : <EOL> """<STR_LIT>""" <EOL> BaseOptimizationMethod ( BaseErrorMeasure , - <NUM_LIT:1> ) <EOL> try : <EOL> BaseOptimizationMethod ( None , - <NUM_LIT:1> ) <EOL> except TypeError : <EOL> pass <EOL> else : <EOL> assert False <EOL> try : <EOL> BaseOptimizationMethod ( BaseOptimizationMethodTest , - <NUM_LIT:1> ) <EOL> except TypeError : <EOL> pass <EOL> else : <EOL> assert False <EOL> def initialization_precision_test ( self ) : <EOL> """<STR_LIT>""" <EOL> for precision in xrange ( - <NUM_LIT:7> , <NUM_LIT:1> , <NUM_LIT:1> ) : <EOL> BaseOptimizationMethod ( BaseErrorMeasure , precision = precision ) <EOL> for precision in [ - <NUM_LIT> , - <NUM_LIT> , - <NUM_LIT:11> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ] : <EOL> try : <EOL> BaseOptimizationMethod ( BaseErrorMeasure , precision = precision ) <EOL> except ValueError : <EOL> pass <EOL> else : <EOL> assert False <EOL> def optimize_value_error_test ( self ) : <EOL> """<STR_LIT>""" <EOL> bom = BaseOptimizationMethod ( BaseErrorMeasure , precision = - <NUM_LIT:3> ) <EOL> bm = BaseMethod ( ) <EOL> bom . optimize ( TimeSeries ( ) , [ bm ] ) <EOL> try : <EOL> bom . optimize ( TimeSeries ( ) , [ ] ) <EOL> except ValueError : <EOL> pass <EOL> else : <EOL> assert False </s>
