code: def test_estimate_competence():
      """
      Test case:
  
      Correct labels: 0000111
      classifier 1:   1010000   (2/7 correct)
      classifier 2:   1000100   (4/7 correct)
      classifier 2:   0010110   (5/7 correct)
  
      Diversity: compute number of common errors (on both classifiers) and
      divide by 7:
      clf1 x clf2: 3/7
      clf1 x clf3: 2/7
      clf2 x clf3: 1/7
  
      clf1 diversity = (3+2)/7 = -5/7 (negative because we use the negative of
                                       double error)
      clf2 diversity = (3+1)/7 = -4/7
      clf3 diversity = (2+1)/7 = -3/7
  
      """
      x = np.array([0, 1, 2, 3, 4, 5, 6]).reshape(-1, 1)
      y = np.array([0, 0, 0, 0, 1, 1, 1])
  
      clf1 = create_base_classifier(np.array([1, 0, 1, 0, 0, 0, 0]))
      clf2 = create_base_classifier(np.array([1, 0, 0, 0, 1, 0, 0]))
      clf3 = create_base_classifier(np.array([0, 0, 1, 0, 1, 1, 0]))
  
      pool_classifiers = [clf1, clf2, clf3]
  
      target = DESKNN(
          pool_classifiers, k=7, pct_accuracy=1, pct_diversity=1
      )
      target.fit(x, y)
      neighbors = np.array([[0, 1, 2, 3, 4, 5, 6]])
      competences, diversity = target.estimate_competence(neighbors)
      assert np.allclose(competences, [2.0 / 7, 4.0 / 7, 5.0 / 7])
      assert np.allclose(diversity, [-5.0 / 7, -4.0 / 7, -3.0 / 7])
  
imports: from unittest.mock import MagicMock
  import numpy
  import pytest
  from sklearn.linear_model import Perceptron
  from sklearn.utils.estimator_checks import check_estimator
  from deslib.des.des_knn import DESKNN
label_desc: Use image node_id 2 for calling a global function with example usage: test_estimate_competence() without return types