code: def test_one_sample():
      """Test that the metrics won't raise error even in an extreme condition
      where there is only one sample with w > 0.
      """
      np.random.seed(123)
      n_samples = 2
      y_true = np.random.randint(2, size=(n_samples,))
      y_pred = np.random.randint(2, size=(n_samples,))
      w = np.array([0, 1])
      all_metrics = [
          dc.metrics.Metric(dc.metrics.recall_score),
          dc.metrics.Metric(dc.metrics.matthews_corrcoef),
          dc.metrics.Metric(dc.metrics.roc_auc_score),
      ]
      for metric in all_metrics:
          _ = metric.compute_singletask_metric(y_true, y_pred, w)
  
file_path: deepchem/deepchem/metrics/tests/test_metrics.py
imports: import numpy
  import deepchem
label_desc: Use image node_id 2 for calling a global function with example usage: test_one_sample() without return types