11import pytest
2- import warnings
32
43from urllib3 import BaseHTTPResponse
54
@@ -36,17 +35,16 @@ def test_start_import_minimal(self, mocker):
3635 """
3736 client , mock_req = build_client_w_faked_response (mocker , body )
3837
39- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
40- my_import = client .start_import ("s3://path/to/file.parquet" )
38+ my_import = client .start_import ("s3://path/to/file.parquet" )
4139
42- # We made some overrides to the print behavior, so we need to
43- # call it to ensure it doesn't raise an exception
44- print (my_import )
40+ # We made some overrides to the print behavior, so we need to
41+ # call it to ensure it doesn't raise an exception
42+ print (my_import )
4543
46- assert my_import .id == "1"
47- assert my_import ["id" ] == "1"
48- assert my_import .to_dict () == {"id" : "1" }
49- assert my_import .__class__ == StartImportResponse
44+ assert my_import .id == "1"
45+ assert my_import ["id" ] == "1"
46+ assert my_import .to_dict () == {"id" : "1" }
47+ assert my_import .__class__ == StartImportResponse
5048
5149 def test_start_import_with_kwargs (self , mocker ):
5250 body = """
@@ -56,19 +54,18 @@ def test_start_import_with_kwargs(self, mocker):
5654 """
5755 client , mock_req = build_client_w_faked_response (mocker , body )
5856
59- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
60- my_import = client .start_import (uri = "s3://path/to/file.parquet" , integration_id = "123-456-789" )
61- assert my_import .id == "1"
62- assert my_import ["id" ] == "1"
63- assert my_import .to_dict () == {"id" : "1" }
64- assert my_import .__class__ == StartImportResponse
57+ my_import = client .start_import (uri = "s3://path/to/file.parquet" , integration_id = "123-456-789" )
58+ assert my_import .id == "1"
59+ assert my_import ["id" ] == "1"
60+ assert my_import .to_dict () == {"id" : "1" }
61+ assert my_import .__class__ == StartImportResponse
6562
66- # By default, use continue error mode
67- _ , call_kwargs = mock_req .call_args
68- assert (
69- call_kwargs ["body" ]
70- == '{"uri": "s3://path/to/file.parquet", "integrationId": "123-456-789", "errorMode": {"onError": "continue"}}'
71- )
63+ # By default, use continue error mode
64+ _ , call_kwargs = mock_req .call_args
65+ assert (
66+ call_kwargs ["body" ]
67+ == '{"uri": "s3://path/to/file.parquet", "integrationId": "123-456-789", "errorMode": {"onError": "continue"}}'
68+ )
7269
7370 @pytest .mark .parametrize (
7471 "error_mode_input" ,
@@ -87,10 +84,9 @@ def test_start_import_with_explicit_error_mode(self, mocker, error_mode_input):
8784 """
8885 client , mock_req = build_client_w_faked_response (mocker , body )
8986
90- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
91- my_import = client .start_import (uri = "s3://path/to/file.parquet" , error_mode = error_mode_input )
92- _ , call_kwargs = mock_req .call_args
93- assert call_kwargs ["body" ] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "continue"}}'
87+ my_import = client .start_import (uri = "s3://path/to/file.parquet" , error_mode = error_mode_input )
88+ _ , call_kwargs = mock_req .call_args
89+ assert call_kwargs ["body" ] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "continue"}}'
9490
9591 def test_start_import_with_abort_error_mode (self , mocker ):
9692 body = """
@@ -100,10 +96,9 @@ def test_start_import_with_abort_error_mode(self, mocker):
10096 """
10197 client , mock_req = build_client_w_faked_response (mocker , body )
10298
103- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
104- my_import = client .start_import (uri = "s3://path/to/file.parquet" , error_mode = ImportErrorMode .ABORT )
105- _ , call_kwargs = mock_req .call_args
106- assert call_kwargs ["body" ] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "abort"}}'
99+ my_import = client .start_import (uri = "s3://path/to/file.parquet" , error_mode = ImportErrorMode .ABORT )
100+ _ , call_kwargs = mock_req .call_args
101+ assert call_kwargs ["body" ] == '{"uri": "s3://path/to/file.parquet", "errorMode": {"onError": "abort"}}'
107102
108103 def test_start_import_with_unknown_error_mode (self , mocker ):
109104 body = """
@@ -113,11 +108,10 @@ def test_start_import_with_unknown_error_mode(self, mocker):
113108 """
114109 client , mock_req = build_client_w_faked_response (mocker , body )
115110
116- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
117- with pytest .raises (ValueError ) as e :
118- my_import = client .start_import (uri = "s3://path/to/file.parquet" , error_mode = "unknown" )
111+ with pytest .raises (ValueError ) as e :
112+ my_import = client .start_import (uri = "s3://path/to/file.parquet" , error_mode = "unknown" )
119113
120- assert "Invalid error_mode value: unknown" in str (e .value )
114+ assert "Invalid error_mode value: unknown" in str (e .value )
121115
122116 def test_start_invalid_uri (self , mocker ):
123117 body = """
@@ -129,9 +123,8 @@ def test_start_invalid_uri(self, mocker):
129123 """
130124 client , mock_req = build_client_w_faked_response (mocker , body , 400 )
131125
132- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
133- with pytest .raises (PineconeApiException ) as e :
134- my_import = client .start_import (uri = "invalid path" )
126+ with pytest .raises (PineconeApiException ) as e :
127+ my_import = client .start_import (uri = "invalid path" )
135128
136129 assert e .value .status == 400
137130 assert e .value .body == body
@@ -140,9 +133,8 @@ def test_start_invalid_uri(self, mocker):
140133 def test_no_arguments (self , mocker ):
141134 client , mock_req = build_client_w_faked_response (mocker , "" )
142135
143- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
144- with pytest .raises (TypeError ) as e :
145- client .start_import ()
136+ with pytest .raises (TypeError ) as e :
137+ client .start_import ()
146138
147139 assert "missing 1 required positional argument" in str (e .value )
148140
@@ -165,17 +157,16 @@ def test_describe_import(self, mocker):
165157 """
166158 client , mock_req = build_client_w_faked_response (mocker , body )
167159
168- with pytest .warns (UserWarning , match = "The bulk import feature is in early access" ):
169- my_import = client .describe_import (id = "1" )
160+ my_import = client .describe_import (id = "1" )
170161
171- # We made some overrides to the print behavior, so we need to
172- # call it to ensure it doesn't raise an exception
173- print (my_import )
162+ # We made some overrides to the print behavior, so we need to
163+ # call it to ensure it doesn't raise an exception
164+ print (my_import )
174165
175- assert my_import .id == "1"
176- assert my_import ["id" ] == "1"
177- desc = my_import .to_dict ()
178- assert desc ["id" ] == "1"
179- assert desc ["records_imported" ] == 1000
180- assert desc ["uri" ] == "s3://path/to/file.parquet"
181- assert desc ["status" ] == "InProgress"
166+ assert my_import .id == "1"
167+ assert my_import ["id" ] == "1"
168+ desc = my_import .to_dict ()
169+ assert desc ["id" ] == "1"
170+ assert desc ["records_imported" ] == 1000
171+ assert desc ["uri" ] == "s3://path/to/file.parquet"
172+ assert desc ["status" ] == "InProgress"
0 commit comments