def testInterface(algo):
 emptyalgo = algo()
 try:
  emptyalgo.learn(0)
  return 'Failed to throw missing evaluator error?'
 except AssertionError:
  pass
 emptyalgo.setEvaluator(sf, xa1)
 emptyalgo.learn(0)
 algo(sf, xa1)
 algo(sf, xa100)
 algo(sf, numParameters=2)
 try:
  algo(sf)
  return 'Failed to throw unknown dimension error'
 except ValueError:
  pass
 algo(ife1)
 algo(ife2, pc2)
 return True

def testInterface ( algo ) : emptyalgo = algo ( ) try : emptyalgo . learn ( 0 ) return 'Failed to throw missing evaluator error?' except AssertionError : pass emptyalgo . setEvaluator ( sf , xa1 ) emptyalgo . learn ( 0 ) algo ( sf , xa1 ) algo ( sf , xa100 ) algo ( sf , numParameters = 2 ) try : algo ( sf ) return 'Failed to throw unknown dimension error' except ValueError : pass algo ( ife1 ) algo ( ife2 , pc2 ) return True
tests whether the algorithm is properly implementing the correct blackbox-optimization interface .