code: def test_call_oracle(Constraints, eps, estimator, mocker):
      X, y, A = _get_data(A_two_dim=False)
      # Using a real estimator here with a mocked `fit` method since we don't actually
      # want to fit one, but rather care about having that object's fit method called exactly once.
      estimator.fit = mocker.MagicMock(name="fit")
      if issubclass(Constraints, LossMoment):
          constraints = Constraints(ZeroOneLoss())
      else:
          constraints = Constraints()
  
      lagrangian = _Lagrangian(
          X=X,
          y=y,
          estimator=estimator,
          constraints=deepcopy(constraints),
          B=1 / eps,
          sensitive_features=A,
      )
  
      # Set up initial lambda vector based on a 0-initialized theta and use separate constraints
      # object for it to avoid the dependence on the lagrangian object.
      (
          lambda_vec,
          new_weights,
          new_labels,
      ) = get_lambda_new_weights_and_labels(constraints, X, y, A)
  
      _ = lagrangian._call_oracle(lambda_vec)
  
      # Ideally we'd prefer calling assert_called_once_with(args) but that is not compatible with
      # pandas data structures.
      assert len(estimator.fit.mock_calls) == 1
      _, args, kwargs = estimator.fit.mock_calls[0]
      assert (args[0] == X).all().all()
      assert (args[1] == new_labels).all()
      assert (kwargs["sample_weight"] == new_weights).all()
      assert lagrangian.n_oracle_calls == 1
      assert len(lagrangian.oracle_execution_times) == 1
  
file_path: fairlearn/test/unit/reductions/exponentiated_gradient/test_lagrangian.py
imports: from copy import deepcopy
  import numpy
  import pandas
  import pytest
  from sklearn.base import BaseEstimator
  from sklearn.dummy import DummyClassifier
  from fairlearn.reductions import BoundedGroupLoss, DemographicParity, EqualizedOdds, ErrorRate, ErrorRateParity, FalsePositiveRateParity, LossMoment, TruePositiveRateParity, ZeroOneLoss
  from fairlearn.reductions._exponentiated_gradient._lagrangian import _MESSAGE_BAD_OBJECTIVE, _Lagrangian
  from fairlearn.reductions._moments.bounded_group_loss import MeanLoss
  from .simple_learners import LeastSquaresBinaryClassifierLearner, MockEstimator
  from .test_utilities import _get_data
label_desc: Use image node_id 2 for calling a global function with example usage: test_call_oracle(Constraints, eps, estimator, mocker) without return types