def plotly_data_set(filepath_json, load_args, save_args, fs_args, plotly_args): return PlotlyDataSet( filepath=filepath_json, load_args=load_args, save_args=save_args, fs_args=fs_args, plotly_args=plotly_args, )
def test_protocol_usage(self, filepath, instance_type, credentials, plotly_args): data_set = PlotlyDataSet( filepath=filepath, credentials=credentials, plotly_args=plotly_args ) assert isinstance(data_set._fs, instance_type) path = filepath.split(PROTOCOL_DELIMITER, 1)[-1] assert str(data_set._filepath) == path assert isinstance(data_set._filepath, PurePosixPath)
def test_catalog_release(self, mocker, plotly_args): fs_mock = mocker.patch("fsspec.filesystem").return_value filepath = "test.json" data_set = PlotlyDataSet(filepath=filepath, plotly_args=plotly_args) data_set.release() fs_mock.invalidate_cache.assert_called_once_with(filepath)
def test_fail_if_invalid_plotly_args_provided(self): plotly_args = [] filepath = "test.json" data_set = PlotlyDataSet(filepath=filepath, plotly_args=plotly_args) with pytest.raises(DataSetError): data_set.save(dummy_dataframe)