'Test the behaviour of spot prices during adjustments.'

@parameterized.expand([('split', 2, 3, 3, 1.5), ('merger', 2, 3, 3, 1.8), ('dividend', 2, 3, 3, 2.88)])
def test_get_value_adjustments(self, adjustment_type, liquid_day_0_price, liquid_day_1_price, illiquid_day_0_price, illiquid_day_1_price_adjusted):

    table_name = (adjustment_type + 's')
    liquid_asset = getattr(self, (adjustment_type.upper() + '_ASSET'))
    illiquid_asset = getattr(self, (('ILLIQUID_' + adjustment_type.upper()) + '_ASSET'))
    adjustments = self.adjustment_reader.get_adjustments_for_sid(table_name, liquid_asset.sid)
    self.assertEqual(1, len(adjustments))
    adjustment = adjustments[0]
    self.assertEqual(adjustment[0], pd.Timestamp('2016-01-06', tz='UTC'))
    bar_data = self.create_bardata(simulation_dt_func=(lambda : self.equity_daily_bar_days[0]))
    self.assertEqual(liquid_day_0_price, bar_data.current(liquid_asset, 'price'))
    bar_data = self.create_bardata(simulation_dt_func=(lambda : self.equity_daily_bar_days[1]))
    self.assertEqual(liquid_day_1_price, bar_data.current(liquid_asset, 'price'))
    bar_data = self.create_bardata(simulation_dt_func=(lambda : self.equity_daily_bar_days[1]))
    self.assertEqual(illiquid_day_0_price, bar_data.current(illiquid_asset, 'price'))
    bar_data = self.create_bardata(simulation_dt_func=(lambda : self.equity_daily_bar_days[2]))
    self.assertAlmostEqual(illiquid_day_1_price_adjusted, bar_data.current(illiquid_asset, 'price'))
