def testInterface(algo):
    # without any arguments, initialization has to work
    emptyalgo = algo()
    try:
        # but not learning
        emptyalgo.learn(0)
        return "Failed to throw missing evaluator error?"
    except AssertionError:
        pass

    emptyalgo.setEvaluator(sf, xa1)
    # not it can run
    emptyalgo.learn(0)

    # simple functions don't check for dimension mismatch
    algo(sf, xa1)
    algo(sf, xa100)

    # for these, either an initial point or a dimension parameter is required
    algo(sf, numParameters=2)

    try:
        algo(sf)
        return "Failed to throw unknown dimension error"
    except ValueError:
        pass

    # FitnessEvaluators do not require that
    algo(ife1)

    # parameter containers can be used too
    algo(ife2, pc2)

    return True
80ms
dataset/ETHPy150Open pybrain/pybrain/pybrain/tests/optimizationtest.py/testInterface--crossover with--dataset/ETHPy150Open algorhythms/LeetCode/096 Unique Binary Search Trees II.py/Solution.generate_cache