diff --git a/pinecone/data/features/bulk_import.py b/pinecone/data/features/bulk_import.py index 47afc16a..b2e36ea9 100644 --- a/pinecone/data/features/bulk_import.py +++ b/pinecone/data/features/bulk_import.py @@ -45,7 +45,9 @@ def __init__(self, **kwargs): api_version=API_VERSION, ) - @prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION) + usage_warning = "The bulk import feature is in early access." + + @prerelease_feature(message=usage_warning, api_version=API_VERSION) def start_import( self, uri: str, @@ -89,7 +91,7 @@ def start_import( return self.__import_operations_api.start_import(StartImportRequest(**args_dict)) - @prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION) + @prerelease_feature(message=usage_warning, api_version=API_VERSION) def list_imports(self, **kwargs) -> Iterator[List[ImportModel]]: """ Returns a generator that yields each import operation. It automatically handles pagination tokens on your behalf so you can @@ -126,7 +128,7 @@ def list_imports(self, **kwargs) -> Iterator[List[ImportModel]]: else: done = True - @prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION) + @prerelease_feature(message=usage_warning, api_version=API_VERSION) def list_imports_paginated( self, limit: Optional[int] = None, @@ -171,7 +173,7 @@ def list_imports_paginated( ) return self.__import_operations_api.list_imports(**args_dict) - @prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION) + @prerelease_feature(message=usage_warning, api_version=API_VERSION) def describe_import(self, id: str) -> ImportModel: """ describe_import is used to get detailed information about a specific import operation. @@ -188,7 +190,7 @@ def describe_import(self, id: str) -> ImportModel: return self.__import_operations_api.describe_import(id=id) - @prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION) + @prerelease_feature(message=usage_warning, api_version=API_VERSION) def cancel_import(self, id: str): """Cancel an import operation. diff --git a/tests/unit/data/test_bulk_import.py b/tests/unit/data/test_bulk_import.py index 5b6266c0..59ae8b8a 100644 --- a/tests/unit/data/test_bulk_import.py +++ b/tests/unit/data/test_bulk_import.py @@ -36,7 +36,7 @@ def test_start_import_minimal(self, mocker): """ client, mock_req = build_client_w_faked_response(mocker, body) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): my_import = client.start_import("s3://path/to/file.parquet") # We made some overrides to the print behavior, so we need to @@ -56,7 +56,7 @@ def test_start_import_with_kwargs(self, mocker): """ client, mock_req = build_client_w_faked_response(mocker, body) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): my_import = client.start_import(uri="s3://path/to/file.parquet", integration_id="123-456-789") assert my_import.id == "1" assert my_import["id"] == "1" @@ -87,7 +87,7 @@ def test_start_import_with_explicit_error_mode(self, mocker, error_mode_input): """ client, mock_req = build_client_w_faked_response(mocker, body) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=error_mode_input) _, call_kwargs = mock_req.call_args assert call_kwargs["body"] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "continue"}}' @@ -100,7 +100,7 @@ def test_start_import_with_abort_error_mode(self, mocker): """ client, mock_req = build_client_w_faked_response(mocker, body) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=ImportErrorMode.ABORT) _, call_kwargs = mock_req.call_args assert call_kwargs["body"] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "abort"}}' @@ -113,7 +113,7 @@ def test_start_import_with_unknown_error_mode(self, mocker): """ client, mock_req = build_client_w_faked_response(mocker, body) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): with pytest.raises(ValueError) as e: my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode="unknown") @@ -129,7 +129,7 @@ def test_start_invalid_uri(self, mocker): """ client, mock_req = build_client_w_faked_response(mocker, body, 400) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): with pytest.raises(PineconeApiException) as e: my_import = client.start_import(uri="invalid path") @@ -140,7 +140,7 @@ def test_start_invalid_uri(self, mocker): def test_no_arguments(self, mocker): client, mock_req = build_client_w_faked_response(mocker, "") - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): with pytest.raises(TypeError) as e: client.start_import() @@ -165,7 +165,7 @@ def test_describe_import(self, mocker): """ client, mock_req = build_client_w_faked_response(mocker, body) - with pytest.warns(UserWarning, match="pre-release"): + with pytest.warns(UserWarning, match="The bulk import feature is in early access"): my_import = client.describe_import(id="1") # We made some overrides to the print behavior, so we need to