'Test that when a double volume switch occurs we treat the first switch
as the roll, assuming it is within a certain distance of the next auto
close date. See `VolumeRollFinder._active_contract` for a full
explanation and example.'

def test_double_volume_switch(self):

    cf = self.asset_finder.create_continuous_future('DF', 0, 'volume', None)
    sessions = self.trading_calendar.sessions_in_range('2016-02-09', '2016-02-17')
    for session in sessions:
        bar_data = self.create_bardata((lambda : session))
        contract = bar_data.current(cf, 'contract')
        if (session < pd.Timestamp('2016-02-11', tz='UTC')):
            self.assertEqual(contract.symbol, 'DFF16')
        else:
            self.assertEqual(contract.symbol, 'DFG16')
