

def double_initialize_test(self):
    'Test for the error ocuring when the same error measure is initialized twice.'
    data = [[0.0, 0.0], [1, 0.1], [2, 0.2], [3, 0.3], [4, 0.4]]
    tsOrg = TimeSeries.from_twodim_list(data)
    tsCalc = TimeSeries.from_twodim_list(data)
    bem = BaseErrorMeasure()
    bem_calculate = bem._calculate
    bem_local_error = bem.local_error

    def return_zero(ignoreMe, ignoreMeToo):
        return 0
    bem.local_error = return_zero
    tsCalc._calculate = return_zero
    bem.initialize(tsOrg, tsCalc)
    for cnt in xrange(10):
        try:
            bem.initialize(tsOrg, tsCalc)
        except StandardError:
            pass
        else:
            assert False
    bem.local_error = bem_calculate
    bem._calculate = bem_local_error

dataset/ETHPy150Open T-002/pycast/pycast/tests/errormeasuretest.py BaseErrorMeasureTest.double_initialize_test/VarMisuse@103/170 `bem`->`tsCalc`