code: def test_estimate_competence_Q():
      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,
          metric="Q",
      )
      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, [2, 1.2, 1.2])
  
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 4 for calling a global function with example usage: test_estimate_competence_Q() without return types