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: Wraps an expectation function with a slice function to discard certain testcases.
  Slice function acts on pairs.
  
  Parameters
  ----------
  expect_fn : function
      an expectation function, where argument is a Test
  slice_fn : function
      A slice function, slices testcases.
      Arguments: (orig_pred, pred, orig_conf, conf, labels=None, meta=None)
      Returns: np.array where True means 'keep' and False means 'discard'
  agg_fn : function
      Aggregates examples within a test case. See aggregate_testcase
  
  Returns
  -------
  function
      The expect function, but now returning None for discarded examples
docstr_tok: ["Wraps","an","expectation","function","with","a","slice","function","to","discard","certain","testcases",".","Slice","function","acts","on","pairs",".","Parameters","--","--","--","--","--","expect_fn",":","function","an","expectation","function",",","where","argument","is","a","Test","slice_fn",":","function","A","slice","function",",","slices","testcases",".","Arguments",":","(","orig_pred",",","pred",",","orig_conf",",","conf",",","labels=None",",","meta=None",")","Returns",":","np.array","where","True","means","'keep","'","and","False","means","'discard'","agg_fn",":","function","Aggregates","examples","within","a","test","case",".","See","aggregate_testcase","Returns","--","--","--","-","function","The","expect","function",",","but","now","returning","None","for","discarded","examples"]
code: def slice_pairwise(expect_fn, slice_fn, agg_fn="all_except_first"):
      """Wraps an expectation function with a slice function to discard certain testcases.
      Slice function acts on pairs.
  
      Parameters
      ----------
      expect_fn : function
          an expectation function, where argument is a Test
      slice_fn : function
          A slice function, slices testcases.
          Arguments: (orig_pred, pred, orig_conf, conf, labels=None, meta=None)
          Returns: np.array where True means 'keep' and False means 'discard'
      agg_fn : function
          Aggregates examples within a test case. See aggregate_testcase
  
      Returns
      -------
      function
          The expect function, but now returning None for discarded examples
  
      """
      wrapped_slice = Expect.pairwise(slice_fn)
      return Expect.wrap_slice(expect_fn, wrapped_slice, agg_fn)
  
imports: import numpy
  import itertools
label_desc: Use image node_id 12 for calling the Expect obj's underlying member method code with example usage: obj.slice_pairwise(expect_fn, slice_fn, agg_fn) and returns: Expect