code: def test_active_chain(self):
      contract_sids = array([1, 2, 3, 4], dtype=int64)
  
      contracts = deque(self.asset_finder.retrieve_all(contract_sids))
  
      oc = OrderedContracts("FO", contracts)
  
      # Test sid 1 as days increment, as the sessions march forward
      # a contract should be added per day, until all defined contracts
      # are returned.
      chain = oc.active_chain(
          1, pd.Timestamp("2014-12-31", tz="UTC").value
      )
      self.assertEquals(
          [],
          list(chain),
          "On session before first start date, no contracts "
          "in chain should be active.",
      )
      chain = oc.active_chain(
          1, pd.Timestamp("2015-01-01", tz="UTC").value
      )
      self.assertEquals(
          [1],
          list(chain),
          "[1] should be the active chain on 01-01, since all "
          "other start dates occur after 01-01.",
      )
  
      chain = oc.active_chain(
          1, pd.Timestamp("2015-01-02", tz="UTC").value
      )
      self.assertEquals(
          [1, 2],
          list(chain),
          "[1, 2] should be the active contracts on 01-02.",
      )
  
      chain = oc.active_chain(
          1, pd.Timestamp("2015-01-03", tz="UTC").value
      )
      self.assertEquals(
          [1, 2, 3],
          list(chain),
          "[1, 2, 3] should be the active contracts on 01-03.",
      )
  
      chain = oc.active_chain(
          1, pd.Timestamp("2015-01-04", tz="UTC").value
      )
      self.assertEquals(
          4,
          len(chain),
          "[1, 2, 3, 4] should be the active contracts on "
          "01-04, this is all defined contracts in the test "
          "case.",
      )
  
      chain = oc.active_chain(
          1, pd.Timestamp("2015-01-05", tz="UTC").value
      )
      self.assertEquals(
          4,
          len(chain),
          "[1, 2, 3, 4] should be the active contracts on "
          "01-05. This tests the case where all start dates "
          "are before the query date.",
      )
  
      # Test querying each sid at a time when all should be alive.
      chain = oc.active_chain(
          2, pd.Timestamp("2015-01-05", tz="UTC").value
      )
      self.assertEquals([2, 3, 4], list(chain))
  
      chain = oc.active_chain(
          3, pd.Timestamp("2015-01-05", tz="UTC").value
      )
      self.assertEquals([3, 4], list(chain))
  
      chain = oc.active_chain(
          4, pd.Timestamp("2015-01-05", tz="UTC").value
      )
      self.assertEquals([4], list(chain))
  
      # Test defined contract to check edge conditions.
      chain = oc.active_chain(
          4, pd.Timestamp("2015-01-03", tz="UTC").value
      )
      self.assertEquals(
          [],
          list(chain),
          "No contracts should be active, since 01-03 is "
          "before 4's start date.",
      )
  
      chain = oc.active_chain(
          4, pd.Timestamp("2015-01-04", tz="UTC").value
      )
      self.assertEquals(
          [4],
          list(chain),
          "[4] should be active beginning at its start date.",
      )
  
imports: from collections import deque
  from functools import partial
  from textwrap import dedent
  from numpy import arange, array, int64, full, repeat, tile
  from numpy.testing import assert_almost_equal
  import pandas
  from pandas import Timestamp, DataFrame
  from zipline.assets.continuous_futures import OrderedContracts, delivery_predicate
  from zipline.assets.roll_finder import ROLL_DAYS_FOR_CURRENT_CONTRACT, VolumeRollFinder
  from zipline.data.minute_bars import FUTURES_MINUTES_PER_DAY
  from zipline.errors import SymbolNotFound
  import zipline.testing.fixtures
label_desc: Use image node_id 4 for calling the OrderedContractsTestCase obj's underlying member method code with example usage: obj.test_active_chain() without return types