def test_last_data(mocker): mocker.patch("gs_quant.api.gs.data.GsDataApi.last_data", return_value=[test_data[-1]]) mocker.patch("gs_quant.api.gs.data.GsDataApi.get_types", return_value=test_types) dataset = Dataset(Dataset.TR.TREOD) data = dataset.get_data_last(dt.date(2019, 1, 9), assetId='MA4B66MW5E27U8P32SB') assert data.equals( GsDataApi.construct_dataframe_with_types(str(Dataset.TR.TREOD), ([test_data[-1]])))
def test_last_data(query_data, get_types): query_data.return_value = [test_data[-1]] get_types.return_value = test_types dataset = Dataset(Dataset.TR.TREOD) data = dataset.get_data_last(dt.date(2019, 1, 9), assetId='MA4B66MW5E27U8P32SB') assert data.equals(construct_dataframe_with_types(str(Dataset.TR.TREOD), ([test_data[-1]])))