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 testcase (may have multiple examples)
  
  Parameters
  ----------
  fn : function
      Arguments: (xs, preds, confs, labels=None, meta=None)
      Returns: np.array, representing results for the examples inside the
      testcase. 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","testcase","(","may","have","multiple","examples",")","Parameters","--","--","--","--","--","fn",":","function","Arguments",":","(","xs",",","preds",",","confs",",","labels=None",",","meta=None",")","Returns",":","np.array",",","representing","results","for","the","examples","inside","the","testcase",".","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 testcase(fn):
      """Expectation over a single testcase (may have multiple examples)
  
      Parameters
      ----------
      fn : function
          Arguments: (xs, preds, confs, labels=None, meta=None)
          Returns: np.array, representing results for the examples inside the
          testcase. 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(self):
          zipped = iter_with_optional(
              self.data,
              self.results.preds,
              self.results.confs,
              self.labels,
              self.meta,
              self.run_idxs,
          )
          return [
              fn(x, pred, confs, labels, meta)
              for x, pred, confs, labels, meta in zipped
          ]
  
      return expect
  
imports: import numpy
  import itertools
label_desc: Use image node_id 2 for calling the Expect obj's underlying member method code with example usage: obj.testcase(fn) and returns: expect, unknown