code: def test_current_chain_in_algo(self):
      code = dedent(
          """
  from zipline.api import (
      record,
      continuous_future,
      schedule_function,
      get_datetime,
  )
  
  def initialize(algo):
      algo.primary_cl = continuous_future('FO', 0, 'calendar', None)
      algo.secondary_cl = continuous_future('FO', 1, 'calendar', None)
      schedule_function(record_current_contract)
  
  def record_current_contract(algo, data):
      record(datetime=get_datetime())
      primary_chain = data.current_chain(algo.primary_cl)
      secondary_chain = data.current_chain(algo.secondary_cl)
      record(primary_len=len(primary_chain))
      record(primary_first=primary_chain[0].symbol)
      record(primary_last=primary_chain[-1].symbol)
      record(secondary_len=len(secondary_chain))
      record(secondary_first=secondary_chain[0].symbol)
      record(secondary_last=secondary_chain[-1].symbol)
  """
      )
      results = self.run_algorithm(script=code)
      result = results.iloc[0]
  
      self.assertEqual(
          result.primary_len,
          6,
          "There should be only 6 contracts in the chain for "
          "the primary, there are 7 contracts defined in the "
          "fixture, but one has a start after the simulation "
          "date.",
      )
      self.assertEqual(
          result.secondary_len,
          5,
          "There should be only 5 contracts in the chain for "
          "the primary, there are 7 contracts defined in the "
          "fixture, but one has a start after the simulation "
          "date. And the first is not included because it is "
          "the primary on that date.",
      )
  
      self.assertEqual(
          result.primary_first,
          "FOF16",
          "Front of primary chain should be FOF16 on first " "session.",
      )
      self.assertEqual(
          result.secondary_first,
          "FOG16",
          "Front of secondary chain should be FOG16 on first "
          "session.",
      )
  
      self.assertEqual(
          result.primary_last,
          "FOG22",
          "End of primary chain should be FOK16 on first " "session.",
      )
      self.assertEqual(
          result.secondary_last,
          "FOG22",
          "End of secondary chain should be FOK16 on first " "session.",
      )
  
      # Second day, primary should switch to FOG
      result = results.iloc[1]
  
      self.assertEqual(
          result.primary_len,
          5,
          "There should be only 5 contracts in the chain for "
          "the primary, there are 7 contracts defined in the "
          "fixture, but one has a start after the simulation "
          "date. The first is not included because of roll.",
      )
      self.assertEqual(
          result.secondary_len,
          4,
          "There should be only 4 contracts in the chain for "
          "the primary, there are 7 contracts defined in the "
          "fixture, but one has a start after the simulation "
          "date. The first is not included because of roll, "
          "the second is the primary on that date.",
      )
  
      self.assertEqual(
          result.primary_first,
          "FOG16",
          "Front of primary chain should be FOG16 on second "
          "session.",
      )
      self.assertEqual(
          result.secondary_first,
          "FOH16",
          "Front of secondary chain should be FOH16 on second "
          "session.",
      )
  
      # These values remain FOJ16 because fixture data is not exhaustive
      # enough to move the end of the chain.
      self.assertEqual(
          result.primary_last,
          "FOG22",
          "End of primary chain should be FOK16 on second " "session.",
      )
      self.assertEqual(
          result.secondary_last,
          "FOG22",
          "End of secondary chain should be FOK16 on second "
          "session.",
      )
  
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 11 for calling the ContinuousFuturesTestCase obj's underlying member method code with example usage: obj.test_current_chain_in_algo() without return types