|
22 | 22 | min_int4,
|
23 | 23 | min_int8,
|
24 | 24 | )
|
25 |
| -from redshift_connector.utils.type_utils import py_types |
| 25 | +from redshift_connector.utils.type_utils import pg_types as PG_TYPES |
| 26 | +from redshift_connector.utils.type_utils import py_types as PY_TYPES |
26 | 27 |
|
27 | 28 | test_error_responses_data: typing.List[typing.Tuple[bytes, typing.Dict, typing.Type[Error]]] = [
|
28 | 29 | (
|
@@ -144,31 +145,32 @@ def test_handle_COPY_DONE():
|
144 | 145 |
|
145 | 146 |
|
146 | 147 | test_inspect_int_vals: typing.List[typing.Tuple[int, typing.Tuple[int, int, typing.Callable]]] = [
|
147 |
| - (min_int2 - 1, py_types[23]), |
148 |
| - (min_int2, py_types[23]), |
149 |
| - (min_int2 + 1, py_types[21]), |
150 |
| - (max_int2 - 1, py_types[21]), |
151 |
| - (max_int2, py_types[23]), |
152 |
| - (max_int2 + 1, py_types[23]), |
153 |
| - (min_int4 - 1, py_types[20]), |
154 |
| - (min_int4, py_types[20]), |
155 |
| - (min_int4 + 1, py_types[23]), |
156 |
| - (max_int4 - 1, py_types[23]), |
157 |
| - (max_int4, py_types[20]), |
158 |
| - (max_int4 + 1, py_types[20]), |
159 |
| - (min_int8 - 1, py_types[Decimal]), |
160 |
| - (min_int8, py_types[Decimal]), |
161 |
| - (min_int8 + 1, py_types[20]), |
162 |
| - (max_int8 - 1, py_types[20]), |
163 |
| - (max_int8, py_types[Decimal]), |
164 |
| - (max_int8 + 1, py_types[Decimal]), |
| 148 | + (min_int2 - 1, PY_TYPES[23]), |
| 149 | + (min_int2, PY_TYPES[23]), |
| 150 | + (min_int2 + 1, PY_TYPES[21]), |
| 151 | + (max_int2 - 1, PY_TYPES[21]), |
| 152 | + (max_int2, PY_TYPES[23]), |
| 153 | + (max_int2 + 1, PY_TYPES[23]), |
| 154 | + (min_int4 - 1, PY_TYPES[20]), |
| 155 | + (min_int4, PY_TYPES[20]), |
| 156 | + (min_int4 + 1, PY_TYPES[23]), |
| 157 | + (max_int4 - 1, PY_TYPES[23]), |
| 158 | + (max_int4, PY_TYPES[20]), |
| 159 | + (max_int4 + 1, PY_TYPES[20]), |
| 160 | + (min_int8 - 1, PY_TYPES[Decimal]), |
| 161 | + (min_int8, PY_TYPES[Decimal]), |
| 162 | + (min_int8 + 1, PY_TYPES[20]), |
| 163 | + (max_int8 - 1, PY_TYPES[20]), |
| 164 | + (max_int8, PY_TYPES[Decimal]), |
| 165 | + (max_int8 + 1, PY_TYPES[Decimal]), |
165 | 166 | ]
|
166 | 167 |
|
167 | 168 |
|
168 | 169 | @pytest.mark.parametrize("_input", test_inspect_int_vals)
|
169 | 170 | def test_inspect_int(_input):
|
170 | 171 | input_val, expected_type = _input
|
171 | 172 | mock_connection = Connection.__new__(Connection)
|
| 173 | + mock_connection.py_types = PY_TYPES |
172 | 174 | assert mock_connection.inspect_int(input_val) == expected_type
|
173 | 175 |
|
174 | 176 |
|
@@ -205,6 +207,7 @@ def test_handle_ROW_DESCRIPTION_extended_metadata(_input, protocol):
|
205 | 207 | data, exp_result = _input
|
206 | 208 | mock_connection = Connection.__new__(Connection)
|
207 | 209 | mock_connection._client_protocol_version = protocol
|
| 210 | + mock_connection.pg_types = dict(PG_TYPES) |
208 | 211 | mock_cursor = Cursor.__new__(Cursor)
|
209 | 212 | mock_cursor.ps = {"row_desc": []}
|
210 | 213 |
|
@@ -240,6 +243,7 @@ def test_handle_ROW_DESCRIPTION_base(_input):
|
240 | 243 | data, exp_result = _input
|
241 | 244 | mock_connection = Connection.__new__(Connection)
|
242 | 245 | mock_connection._client_protocol_version = ClientProtocolVersion.BASE_SERVER.value
|
| 246 | + mock_connection.pg_types = dict(PG_TYPES) |
243 | 247 | mock_cursor = Cursor.__new__(Cursor)
|
244 | 248 | mock_cursor.ps = {"row_desc": []}
|
245 | 249 |
|
|
0 commit comments