def test_remove_from_cache(populated_cache: TaigaCache): populated_cache.remove_from_cache(COLUMNAR_FULL_TAIGA_ID, COLUMNAR_FULL_TAIGA_ID) assert ( populated_cache.get_entry(COLUMNAR_FULL_TAIGA_ID, COLUMNAR_FULL_TAIGA_ID) is None ) assert ( populated_cache.get_entry(COLUMNAR_TAIGA_ID_ALIAS, COLUMNAR_FULL_TAIGA_ID) is None ) assert ( populated_cache.get_entry(COLUMNAR_VIRTUAL_TAIGA_ID, COLUMNAR_FULL_TAIGA_ID) is None ) c = populated_cache.conn.cursor() c.execute( """ SELECT * FROM datafiles """ ) rows = c.fetchall() assert len(rows) == 1
def test_get_entry( populated_cache: TaigaCache, expected_df: pd.DataFrame, full_taiga_id: str, taiga_id_alias: str, virtual_taiga_id: str, ): """ TODO: - get full_taiga_id should return the df - get virtual taiga id should not return the df until the link has been added - then add virtual taiga id (need to figure out parameters) - get virtual taiga id should return df - same for alias - removing the actual file should remove the entry just for the actual taiga id, but not the aliases/virtual taiga id """ df = populated_cache.get_entry(full_taiga_id, full_taiga_id) assert df.equals(expected_df) df_alias = populated_cache.get_entry(taiga_id_alias, full_taiga_id) assert df_alias.equals(df) df_virtual = populated_cache.get_entry(virtual_taiga_id, full_taiga_id) assert df_virtual.equals(df)