code: def test_binary_with_zero_pred():
      """Test that metric works with edge case where confidence is zero for a bin."""
      preds = torch.tensor([1.0, 1.0, 1.0, 1.0, 0.0])
      target = torch.tensor([0, 0, 1, 1, 1])
      assert binary_calibration_error(
          preds, target, n_bins=2, norm="l1"
      ) == torch.tensor(0.6)
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from netcal.metrics import ECE, MCE
  from scipy.special import expit
  from scipy.special import softmax
  from torchmetrics.classification.calibration_error import BinaryCalibrationError, CalibrationError, MulticlassCalibrationError
  from torchmetrics.functional.classification.calibration_error import binary_calibration_error, multiclass_calibration_error
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_1_13
  from unittests import NUM_CLASSES
  from unittests.classification.inputs import _binary_cases, _multiclass_cases
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester, inject_ignore_index, remove_ignore_index
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_with_zero_pred() without return types