Skip to content

Commit 31ee39a

Browse files
committed
Adjust warning message
1 parent 4864f8d commit 31ee39a

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

pinecone/data/features/bulk_import.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ def __init__(self, **kwargs):
4545
api_version=API_VERSION,
4646
)
4747

48-
@prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION)
48+
usage_warning = "The bulk import feature is in early access."
49+
50+
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
4951
def start_import(
5052
self,
5153
uri: str,
@@ -89,7 +91,7 @@ def start_import(
8991

9092
return self.__import_operations_api.start_import(StartImportRequest(**args_dict))
9193

92-
@prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION)
94+
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
9395
def list_imports(self, **kwargs) -> Iterator[List[ImportModel]]:
9496
"""
9597
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]]:
126128
else:
127129
done = True
128130

129-
@prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION)
131+
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
130132
def list_imports_paginated(
131133
self,
132134
limit: Optional[int] = None,
@@ -171,7 +173,7 @@ def list_imports_paginated(
171173
)
172174
return self.__import_operations_api.list_imports(**args_dict)
173175

174-
@prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION)
176+
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
175177
def describe_import(self, id: str) -> ImportModel:
176178
"""
177179
describe_import is used to get detailed information about a specific import operation.
@@ -188,7 +190,7 @@ def describe_import(self, id: str) -> ImportModel:
188190

189191
return self.__import_operations_api.describe_import(id=id)
190192

191-
@prerelease_feature(message="The bulk import feature is in pre-release.", api_version=API_VERSION)
193+
@prerelease_feature(message=usage_warning, api_version=API_VERSION)
192194
def cancel_import(self, id: str):
193195
"""Cancel an import operation.
194196

tests/unit/data/test_bulk_import.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_start_import_minimal(self, mocker):
3636
"""
3737
client, mock_req = build_client_w_faked_response(mocker, body)
3838

39-
with pytest.warns(UserWarning, match="pre-release"):
39+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
4040
my_import = client.start_import("s3://path/to/file.parquet")
4141

4242
# We made some overrides to the print behavior, so we need to
@@ -56,7 +56,7 @@ def test_start_import_with_kwargs(self, mocker):
5656
"""
5757
client, mock_req = build_client_w_faked_response(mocker, body)
5858

59-
with pytest.warns(UserWarning, match="pre-release"):
59+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
6060
my_import = client.start_import(uri="s3://path/to/file.parquet", integration_id="123-456-789")
6161
assert my_import.id == "1"
6262
assert my_import["id"] == "1"
@@ -87,7 +87,7 @@ def test_start_import_with_explicit_error_mode(self, mocker, error_mode_input):
8787
"""
8888
client, mock_req = build_client_w_faked_response(mocker, body)
8989

90-
with pytest.warns(UserWarning, match="pre-release"):
90+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
9191
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=error_mode_input)
9292
_, call_kwargs = mock_req.call_args
9393
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):
100100
"""
101101
client, mock_req = build_client_w_faked_response(mocker, body)
102102

103-
with pytest.warns(UserWarning, match="pre-release"):
103+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
104104
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode=ImportErrorMode.ABORT)
105105
_, call_kwargs = mock_req.call_args
106106
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):
113113
"""
114114
client, mock_req = build_client_w_faked_response(mocker, body)
115115

116-
with pytest.warns(UserWarning, match="pre-release"):
116+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
117117
with pytest.raises(ValueError) as e:
118118
my_import = client.start_import(uri="s3://path/to/file.parquet", error_mode="unknown")
119119

@@ -129,7 +129,7 @@ def test_start_invalid_uri(self, mocker):
129129
"""
130130
client, mock_req = build_client_w_faked_response(mocker, body, 400)
131131

132-
with pytest.warns(UserWarning, match="pre-release"):
132+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
133133
with pytest.raises(PineconeApiException) as e:
134134
my_import = client.start_import(uri="invalid path")
135135

@@ -140,7 +140,7 @@ def test_start_invalid_uri(self, mocker):
140140
def test_no_arguments(self, mocker):
141141
client, mock_req = build_client_w_faked_response(mocker, "")
142142

143-
with pytest.warns(UserWarning, match="pre-release"):
143+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
144144
with pytest.raises(TypeError) as e:
145145
client.start_import()
146146

@@ -165,7 +165,7 @@ def test_describe_import(self, mocker):
165165
"""
166166
client, mock_req = build_client_w_faked_response(mocker, body)
167167

168-
with pytest.warns(UserWarning, match="pre-release"):
168+
with pytest.warns(UserWarning, match="The bulk import feature is in early access"):
169169
my_import = client.describe_import(id="1")
170170

171171
# We made some overrides to the print behavior, so we need to

0 commit comments

Comments
 (0)