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: Creates a wrapper that combines two expectation functions
  
  Parameters
  ----------
  expect_fn1 : function
      an expectation function, where argument is a Test
  expect_fn2 : function
      an expectation function, where argument is a Test
  combine_fn : function
      Arguments: (x1, x2), the output of (expect_fn1, expect_fn2)
      Returns: bool, float, or int. See docstring for the Expect class
      for what different values in the output mean.
  ignore_none : bool
      If True, will take x1 if x2 is None and vice versa. If both are Nones,
      will return None without calling combine_fn.
  
  Returns
  -------
  function
      wrapped expectation function
docstr_tok: ["Creates","a","wrapper","that","combines","two","expectation","functions","Parameters","--","--","--","--","--","expect_fn1",":","function","an","expectation","function",",","where","argument","is","a","Test","expect_fn2",":","function","an","expectation","function",",","where","argument","is","a","Test","combine_fn",":","function","Arguments",":","(","x1",",","x2",")",",","the","output","of","(","expect_fn1",",","expect_fn2",")","Returns",":","bool",",","float",",","or","int",".","See","docstring","for","the","Expect","class","for","what","different","values","in","the","output","mean",".","ignore_none",":","bool","If","True",",","will","take","x1","if","x2","is","None","and","vice","versa",".","If","both","are","Nones",",","will","return","None","without","calling","combine_fn",".","Returns","--","--","--","-","function","wrapped","expectation","function"]
code: def combine(expect_fn1, expect_fn2, combine_fn, ignore_none=True):
      """Creates a wrapper that combines two expectation functions
  
      Parameters
      ----------
      expect_fn1 : function
          an expectation function, where argument is a Test
      expect_fn2 : function
          an expectation function, where argument is a Test
      combine_fn : function
          Arguments: (x1, x2), the output of (expect_fn1, expect_fn2)
          Returns: bool, float, or int. See docstring for the Expect class
          for what different values in the output mean.
      ignore_none : bool
          If True, will take x1 if x2 is None and vice versa. If both are Nones,
          will return None without calling combine_fn.
  
      Returns
      -------
      function
          wrapped expectation function
  
      """
  
      # each expect_fn takes 'self' as input (i.e. wrapped by Expect.test or Expect.testcase)
      # combine_fn takes (x1, x2), where each is an output from expect_fn1 or
      # 2 (a single example within a testcase, which is a float, a bool, or
      # None) and combines them into a float, a bool, or None if
      # ignore_none=True, will take one of the inputs if the other is None
      # without passing them to the combine_fn (and return None if both are
      # Nones. otherwise, combine_fn must handle Nones)
      def tmp_fn(self):
          e1 = expect_fn1(self)
          e2 = expect_fn2(self)
          ret = []
          for list1, list2 in zip(e1, e2):
              r = []
              for z1, z2 in zip(list1, list2):
                  if ignore_none:
                      if z1 == None:
                          r.append(z2)
                          continue
                      elif z2 == None:
                          r.append(z1)
                          continue
                  r.append(combine_fn(z1, z2))
              ret.append(np.array(r))
          return ret
  
      return tmp_fn
  
imports: import numpy
  import itertools
label_desc: Use image node_id 13 for calling the Expect obj's underlying member method code with example usage: obj.combine(expect_fn1, expect_fn2, combine_fn, ignore_none) and returns: tmp_fn, ret