def test_cacheable_no_save_dataframe(mock_json_utilities, mock_dataframe): @cacheable() def get_hemispheres(): return RmaApi().model_query(model='Hemisphere') df = get_hemispheres(**Cache.nocache_dataframe()) assert df.loc[:, 'whatever'][0] mock_json_utilities.read_url_get.assert_called_once_with( 'http://api.brain-map.org/api/v2/data/query.json?q=model::Hemisphere') assert not mock_dataframe.to_csv.called, 'to_csv should not have been called' assert not mock_dataframe.from_csv.called, 'from_csv should not have been called' assert not mock_json_utilities.write.called, 'json write should not have been called' assert not mock_json_utilities.read.called, 'json read should not have been called'
def test_cacheable_no_save_dataframe(to_csv, read_csv, ju_read_url_get, ju_read, ju_write): @cacheable() def get_hemispheres(): return RmaApi().model_query(model='Hemisphere') df = get_hemispheres(**Cache.nocache_dataframe()) assert df.loc[:, 'whatever'][0] ju_read_url_get.assert_called_once_with( 'http://api.brain-map.org/api/v2/data/query.json?q=model::Hemisphere') assert not to_csv.called, 'to_csv should not have been called' assert not read_csv.called, 'read_csv should not have been called' assert not ju_write.called, 'json write should not have been called' assert not ju_read.called, 'json read should not have been called'