class_docstr: Tests for verifying that SimplePipelineEngine calls hooks as expected.
      
class_docstr_tok: ["Tests","for","verifying","that","SimplePipelineEngine","calls","hooks","as","expected","."]
code: def expect_context_pair(self, enter, exit_, method):
      self.assertEqual(enter.state, "enter")
      self.assertEqual(exit_.state, "exit")
  
      if method is None:
          # Just assert that the methods match.
          self.assertIs(enter.call, exit_.call)
      else:
          self.assertEqual(enter.call.method_name, method)
  
imports: import itertools
  from operator import attrgetter
  import numpy
  import pandas
  import toolz
  from zipline.pipeline import Pipeline
  from zipline.pipeline.classifiers import Everything
  from zipline.pipeline.domain import US_EQUITIES
  from zipline.pipeline.factors import CustomFactor
  from zipline.pipeline.data import Column, DataSet
  from zipline.pipeline.data.testing import TestingDataSet
  from zipline.pipeline.hooks.testing import TestingHooks
  from zipline.pipeline.hooks.progress import ProgressHooks, repr_htmlsafe, TestingProgressPublisher
  from zipline.pipeline.term import AssetExists, ComputableTerm, LoadableTerm
  from zipline.testing import parameter_space
  from zipline.testing.fixtures import ZiplineTestCase, WithSeededRandomPipelineEngine
  from zipline.testing.predicates import assert_almost_equal, instance_of
label_desc: Use image node_id 6 for calling the HooksTestCase obj's underlying member method code with example usage: obj.expect_context_pair(enter, exit_, method) without return types