def test_specific_format_for_scalar_presenter_with_ignore_formatting( self, mocker): mock_write_scalar_res = mocker.patch( 'openvino.tools.accuracy_checker.presenters.write_scalar_result' ) # type: MagicMock result = EvaluationResult(name='vector_metric', metric_type='metric', evaluated_value=[0.456], reference_value=None, abs_threshold=None, rel_threshold=None, meta={ 'scale': 0.5, 'postfix': 'km/h', 'data_format': '{:.4f}' }, profiling_file=None) presenter = ScalarPrintPresenter() presenter.write_result(result, ignore_results_formatting=True) mock_write_scalar_res.assert_called_once_with(np.mean( result.evaluated_value), result.name, result.reference_value, result.abs_threshold, result.rel_threshold, postfix=' ', scale=1, result_format='{}')
def test_reference_value_for_scalar_presenter(self, mocker): mock_write_scalar_res = mocker.patch( 'openvino.tools.accuracy_checker.presenters.write_scalar_result' ) # type: MagicMock result = EvaluationResult(name='vector_metric', metric_type='metric', evaluated_value=[0.456], reference_value=0.456, abs_threshold=None, rel_threshold=None, meta={}, profiling_file=None) presenter = ScalarPrintPresenter() presenter.write_result(result) mock_write_scalar_res.assert_called_once_with( np.mean(result.evaluated_value), result.name, result.abs_threshold, result.rel_threshold, (0.0, 0.0), postfix='%', scale=100, result_format='{:.2f}')