Exemplo n.º 1
0
def test_get_csv_with_a_cache_does_not_reload_file(source_file2: SourceFile):
    source_file2.get_csv_as_df(apply_dtypes=False, cache=True)
    source_file2._retrieve_cached_df = MagicMock()
    source_file2._read_csv_as_df = MagicMock()
    source_file2.get_csv_as_df(apply_dtypes=False, cache=True)
    source_file2._retrieve_cached_df.assert_called_once()
    source_file2._read_csv_as_df.assert_not_called()
Exemplo n.º 2
0
def test_force_reload_ignores_cache(source_file2: SourceFile):
    source_file2.get_csv_as_df(apply_dtypes=False, cache=True)
    source_file2._retrieve_cached_df = MagicMock()
    source_file2._read_csv_as_df = MagicMock()
    source_file2.get_csv_as_df(apply_dtypes=False,
                               cache=True,
                               force_reload=True)
    source_file2._retrieve_cached_df.assert_not_called()
    source_file2._read_csv_as_df.assert_called_once()