|
1 | | -# Copyright 2023-present MongoDB, Inc. |
| 1 | +# Copyright 2025-present MongoDB, Inc. |
2 | 2 | # |
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
4 | 4 | # you may not use this file except in compliance with the License. |
|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | | -import numpy as np |
15 | | -import pandas as pd |
16 | | -import pytest |
17 | | - |
18 | | -# Fixtures for use with Pandas extension types. |
19 | | - |
20 | | - |
21 | | -@pytest.fixture |
22 | | -def data_for_twos(dtype): |
23 | | - return pd.array(np.ones(100), dtype=dtype) |
24 | | - |
25 | | - |
26 | | -@pytest.fixture |
27 | | -def na_value(): |
28 | | - return np.nan |
29 | | - |
30 | | - |
31 | | -@pytest.fixture |
32 | | -def na_cmp(): |
33 | | - def cmp(a, b): |
34 | | - return np.isnan(a) and np.isnan(b) |
35 | | - |
36 | | - return cmp |
37 | | - |
38 | | - |
39 | | -@pytest.fixture(params=[True, False]) |
40 | | -def box_in_series(request): |
41 | | - """Whether to box the data in a Series""" |
42 | | - return request.param |
43 | | - |
44 | | - |
45 | | -@pytest.fixture(params=[True, False]) |
46 | | -def as_array(request): |
47 | | - """ |
48 | | - Boolean fixture to support ExtensionDtype _from_sequence method testing. |
49 | | - """ |
50 | | - return request.param |
| 14 | +from test import client_context |
51 | 15 |
|
| 16 | +import pytest |
52 | 17 |
|
53 | | -@pytest.fixture(params=["ffill", "bfill"]) |
54 | | -def fillna_method(request): |
55 | | - """ |
56 | | - Parametrized fixture giving method parameters 'ffill' and 'bfill' for |
57 | | - Series.fillna(method=<method>) testing. |
58 | | - """ |
59 | | - return request.param |
| 18 | +pytest_plugins = [ |
| 19 | + "pandas.tests.extension.conftest", |
| 20 | +] |
60 | 21 |
|
61 | 22 |
|
62 | | -@pytest.fixture |
63 | | -def invalid_scalar(data): |
64 | | - """ |
65 | | - A scalar that *cannot* be held by this ExtensionArray. |
66 | | - The default should work for most subclasses, but is not guaranteed. |
67 | | - If the array can hold any item (i.e. object dtype), then use pytest.skip. |
68 | | - """ |
69 | | - return object.__new__(object) |
| 23 | +@pytest.fixture(autouse=True, scope="session") |
| 24 | +def client(): |
| 25 | + client_context.init() |
| 26 | + yield |
| 27 | + if client_context.client: |
| 28 | + client_context.client.close() |
0 commit comments