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: Expect predictions to be equal to a value.
  See documentation for Expect.single
  
  Parameters
  ----------
  val : whatever or None
      If None, expect prediction to be equal to label. Otherwise, to be equal to val
  
  Returns
  -------
  function
      an expectation function
docstr_tok: ["Expect","predictions","to","be","equal","to","a","value",".","See","documentation","for","Expect.single","Parameters","--","--","--","--","--","val",":","whatever","or","None","If","None",",","expect","prediction","to","be","equal","to","label",".","Otherwise",",","to","be","equal","to","val","Returns","--","--","--","-","function","an","expectation","function"]
code: def eq(val=None):
      """Expect predictions to be equal to a value.
      See documentation for Expect.single
  
      Parameters
      ----------
      val : whatever or None
          If None, expect prediction to be equal to label. Otherwise, to be equal to val
  
      Returns
      -------
      function
          an expectation function
  
      """
  
      def ret_fn(x, pred, conf, label=None, meta=None):
          gt = val if val is not None else label
          softmax = type(conf) in [np.array, np.ndarray]
          conf = conf[gt] if softmax else -conf
          conf_viol = -(1 - conf)
          if pred == gt:
              return True
          else:
              return conf_viol
  
      return Expect.single(ret_fn)
  
imports: import numpy
  import itertools
label_desc: Use image node_id 16 for calling the Expect obj's underlying member method code with example usage: obj.eq(val) and returns: Expect, True, conf_viol