Ejemplo n.º 1
0
def test_turn_on_caching():
    """
    *.get_dataframe() dataframe is retained when we turning on caching.
    """
    sd = EventTableSubset(start="2016-01-01", stop="2016-01-02")
    sd.get_dataframe()
    sd.turn_off_caching()
    sd.turn_on_caching()
    sd.get_dataframe()
    assert isinstance(sd._df, pd.DataFrame)
Ejemplo n.º 2
0
def test_cache_is_returned():
    """
    Cache property is returned when called.
    """
    sd = EventTableSubset(start="2016-01-01", stop="2016-01-02")
    sd.get_dataframe()
    sd.turn_on_caching()
    assert sd.cache

    sd.turn_off_caching()
    assert not sd.cache
Ejemplo n.º 3
0
def test_turn_off_caching_handles_error():
    """
    *.turn_off_caching() works even if ._df attribute is not present.
    """
    sd = EventTableSubset(start="2016-01-01", stop="2016-01-02")
    sd.get_dataframe()
    sd.turn_off_caching()
    sd.turn_on_caching()
    sd.get_dataframe()

    del sd._df
    sd.turn_off_caching()