code: def test_daily_history_blended_gaps(self, field):
      # daily history windows that end mid-day use minute values for the
      # last day
  
      # January 2015 has both daily and minute data for ASSET2
      day = pd.Timestamp("2015-01-08", tz="UTC")
      minutes = self.trading_calendar.minutes_for_session(day)
  
      equity_cal = self.trading_calendars[Equity]
      equity_minutes = equity_cal.minutes_for_session(day)
      equity_open, equity_close = equity_minutes[0], equity_minutes[-1]
  
      # minute data, baseline:
      # Jan 5: 2 to 391
      # Jan 6: 392 to 781
      # Jan 7: 782 to 1172
      for minute in minutes:
          idx = equity_minutes.searchsorted(min(minute, equity_close))
  
          window = self.data_portal.get_history_window(
              [self.ASSET2],
              minute,
              3,
              "1d",
              field,
              "minute",
          )[self.ASSET2]
  
          self.assertEqual(len(window), 3)
  
          if field == "open":
              self.assertEqual(window[0], 393)
              self.assertEqual(window[1], 783)
          elif field == "high":
              self.assertEqual(window[0], 783)
              self.assertEqual(window[1], 1173)
          elif field == "low":
              self.assertEqual(window[0], 391)
              self.assertEqual(window[1], 781)
          elif field == "close":
              self.assertEqual(window[0], 781)
              self.assertEqual(window[1], 1171)
          elif field == "price":
              self.assertEqual(window[0], 781)
              self.assertEqual(window[1], 1171)
          elif field == "volume":
              self.assertEqual(window[0], 22873500)
              self.assertEqual(window[1], 38083500)
  
          last_val = -1
  
          if minute < equity_open:
              # If before the equity calendar open, we don't yet
              # have data (but price is forward-filled).
              if field == "volume":
                  last_val = 0
              elif field == "price":
                  last_val = window[1]
              else:
                  last_val = nan
          elif field == "open":
              if idx == 0:
                  last_val = np.nan
              else:
                  last_val = 1174.0
          elif field == "high":
              # since we increase monotonically, it's just the last
              # value
              if idx == 0:
                  last_val = np.nan
              elif idx == 389:
                  last_val = 1562.0
              else:
                  last_val = 1174.0 + idx
          elif field == "low":
              # since we increase monotonically, the low is the first
              # value of the day
              if idx == 0:
                  last_val = np.nan
              else:
                  last_val = 1172.0
          elif field == "close":
              if idx == 0:
                  last_val = np.nan
              elif idx == 389:
                  last_val = 1172.0 + 388
              else:
                  last_val = 1172.0 + idx
          elif field == "price":
              if idx == 0:
                  last_val = 1171.0
              elif idx == 389:
                  last_val = 1172.0 + 388
              else:
                  last_val = 1172.0 + idx
          elif field == "volume":
              # for volume, we sum up all the minutely volumes so far
              # today
              if idx == 0:
                  last_val = 0
              elif idx == 389:
                  last_val = sum(
                      np.array(range(1173, 1172 + 388 + 1)) * 100
                  )
              else:
                  last_val = sum(
                      np.array(range(1173, 1172 + idx + 1)) * 100
                  )
  
          np.testing.assert_almost_equal(
              window[-1],
              last_val,
              err_msg="field={0} minute={1}".format(field, minute),
          )
  
imports: from textwrap import dedent
  from nose_parameterized import parameterized
  import numpy
  from numpy import nan
  import pandas
  from six import iteritems
  from catalyst import TradingAlgorithm
  from catalyst._protocol import handle_non_market_minutes, BarData
  from catalyst.assets import Asset, Equity
  from catalyst.errors import HistoryInInitialize, HistoryWindowStartsBeforeData
  from catalyst.finance.trading import SimulationParameters
  from catalyst.finance.asset_restrictions import NoRestrictions
  from catalyst.testing import create_minute_df_for_asset, str_to_seconds, MockDailyBarReader
  from catalyst.testing.fixtures import WithCreateBarData, WithDataPortal, CatalystTestCase, alias
label_desc: Use image node_id 18 for calling the MinuteEquityHistoryTestCase obj's underlying member method code with example usage: obj.test_daily_history_blended_gaps(field) without return types