class_docstr: Helpers for writing expectation functions over tests.
  Each test has a list of testcases, and each testcase has a list of examples.
  Expectation function will act on whole tests, testcases, individual examples, or pairs of examples.
  In any of these, the output of an expectation function for a single example
  is an integer, float, bool, or None, where:
      > 0 (or True) means passed,
      <= 0 or False means fail, and (optionally) the magnitude of the
        failure, indicated by distance from 0, e.g. -10 is worse than -1
      None means the test does not apply, and this should not be counted
docstr: Expectation over a single example
  
  Parameters
  ----------
  fn : function
      Arguments: (x, pred, conf, label=None, meta=None)
      Returns: bool, float, or int. See docstring for the Expect class
      for what different values in the output mean.
  Returns
  -------
  function
      Arguments: AbstractTest
      Returns: List of np.arrays
docstr_tok: ["Expectation","over","a","single","example","Parameters","--","--","--","--","--","fn",":","function","Arguments",":","(","x",",","pred",",","conf",",","label=None",",","meta=None",")","Returns",":","bool",",","float",",","or","int",".","See","docstring","for","the","Expect","class","for","what","different","values","in","the","output","mean",".","Returns","--","--","--","-","function","Arguments",":","AbstractTest","Returns",":","List","of","np.arrays"]
code: def single(fn):
      """Expectation over a single example
  
      Parameters
      ----------
      fn : function
          Arguments: (x, pred, conf, label=None, meta=None)
          Returns: bool, float, or int. See docstring for the Expect class
          for what different values in the output mean.
      Returns
      -------
      function
          Arguments: AbstractTest
          Returns: List of np.arrays
      """
  
      def expect_fn(xs, preds, confs, label=None, meta=None):
          return np.array(
              [
                  fn(x, p, c, l, m)
                  for x, p, c, l, m in iter_with_optional(
                      xs, preds, confs, label, meta
                  )
              ]
          )
  
      return Expect.testcase(expect_fn)
  
imports: import numpy
  import itertools
label_desc: Use image node_id 3 for calling the Expect obj's underlying member method code with example usage: obj.single(fn) and returns: Expect, np