def test_evaluate_calls_perform_eval_correctly_all_metrics(
      self, mock_perform_eval
  ):
    """Test evaluate function calls _perform_eval with expected args when all criteria/keys are present."""
    # Arrange
    mock_perform_eval.return_value = (
        MOCK_EVAL_RESULT  # Configure the mock return value
    )

    raw_data = [[SAMPLE_TURN_1_ALL_KEYS]]
    criteria = ["response_evaluation_score", "response_match_score"]

    # Act
    summary = ResponseEvaluator.evaluate(raw_data, criteria)

    # Assert
    # 1. Check metrics determined by _get_metrics (passed to _perform_eval)
    expected_metrics_list = [
        MetricPromptTemplateExamples.Pointwise.COHERENCE,
        "rouge_1",
    ]
    # 2. Check DataFrame prepared (passed to _perform_eval)
    expected_df_data = [{
        "prompt": "query1",
        "response": "response1",
        "actual_tool_use": [{"tool_name": "tool_a", "tool_input": {}}],
        "reference_trajectory": [{"tool_name": "tool_a", "tool_input": {}}],
        "reference": "reference1",
    }]
    expected_df = pd.DataFrame(expected_df_data)

    # Assert _perform_eval was called once
    mock_perform_eval.assert_called_once()
    # Get the arguments passed to the mocked _perform_eval
    _, kwargs = mock_perform_eval.call_args
    # Check the 'dataset' keyword argument
    pd.testing.assert_frame_equal(kwargs["dataset"], expected_df)
    # Check the 'metrics' keyword argument
    assert kwargs["metrics"] == expected_metrics_list

    # 3. Check the correct summary metrics are returned
    # (from mock_perform_eval's return value)
    assert summary == MOCK_EVAL_RESULT.summary_metrics
Test evaluate function calls _perform_eval with expected args when all criteria/keys are present.
tests/unittests/evaluation/test_response_evaluator.py