def test_optimization_disabled(self): error = BaseErrorMeasure() error._disable_instance_optimization() cerror.initialize = Mock() try: error.initialize(None, None) #parameters irrelevant for this test except: pass assert not cerror.initialize.called, "If optimization is disabled the c method should not be called"
def test_optimization_disabled(self): error = BaseErrorMeasure() error._disable_instance_optimization() cerror.initialize = Mock() try: error.initialize(None, None) #parameters irrelevant for this test except: pass assert not cerror.initialize.called, "If optimization is disabled the c method should not be called"
def test_function_call_is_transparent(self): """ With and without optimization the method should be called with the same parameters. """ old_error = BaseErrorMeasure.local_error BaseErrorMeasure.local_error = Mock() ts = TimeSeries.from_twodim_list([[1,1]]) error = BaseErrorMeasure() error._enable_instance_optimization() error.initialize(ts, ts) error = BaseErrorMeasure() error._disable_instance_optimization() error.initialize(ts, ts)
def test_function_call_is_transparent(self): """ With and without optimization the method should be called with the same parameters. """ oldError = BaseErrorMeasure.local_error BaseErrorMeasure.local_error = Mock() ts = TimeSeries.from_twodim_list([[1, 1]]) error = BaseErrorMeasure() error._enable_instance_optimization() error.initialize(ts, ts) error = BaseErrorMeasure() error._disable_instance_optimization() error.initialize(ts, ts) BaseErrorMeasure.local_error = oldError