Skip to content

Commit 2793f91

Browse files
Compliance with pre-commit
- Added 1 test for no packages Co-authored-by: Afonso Antunes <[email protected]>
1 parent 678b2dc commit 2793f91

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
TODO
1+
TODO

pandas/tests/test_plugis_entrypoint_loader.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
import pandas as pd
2-
from pandas._testing._warnings import assert_produces_warning
2+
import pandas._testing as tm
33
from pandas.core.accessor import DataFrameAccessorLoader
44

55

6+
def test_no_accessors(monkeypatch):
7+
# GH29076
8+
9+
# Mock entry_points
10+
def mock_entry_points(*, group):
11+
return []
12+
13+
# Patch entry_points in the correct module
14+
monkeypatch.setattr("pandas.core.accessor.entry_points", mock_entry_points)
15+
16+
DataFrameAccessorLoader.load()
17+
18+
619
def test_load_dataframe_accessors(monkeypatch):
720
# GH29076
821
# Mocked EntryPoint to simulate a plugin
@@ -74,7 +87,7 @@ def mock_entry_points(*, group):
7487
monkeypatch.setattr("pandas.core.accessor.entry_points", mock_entry_points)
7588

7689
# Check that the UserWarning is raised
77-
with assert_produces_warning(UserWarning, match="duplicate_accessor") as record:
90+
with tm.assert_produces_warning(UserWarning, match="duplicate_accessor") as record:
7891
DataFrameAccessorLoader.load()
7992

8093
messages = [str(w.message) for w in record]
@@ -123,7 +136,7 @@ def mock_entry_points(*, group):
123136
monkeypatch.setattr("pandas.core.accessor.entry_points", mock_entry_points)
124137

125138
# Check that no UserWarning is raised
126-
with assert_produces_warning(None, check_stacklevel=False):
139+
with tm.assert_produces_warning(None, check_stacklevel=False):
127140
DataFrameAccessorLoader.load()
128141

129142
df = pd.DataFrame({"x": [1, 2, 3]})
@@ -185,7 +198,7 @@ def mock_entry_points(*, group):
185198
monkeypatch.setattr("pandas.core.accessor.entry_points", mock_entry_points)
186199

187200
# Capture warnings
188-
with assert_produces_warning(UserWarning, match="duplicate_accessor") as record:
201+
with tm.assert_produces_warning(UserWarning, match="duplicate_accessor") as record:
189202
DataFrameAccessorLoader.load()
190203

191204
messages = [str(w.message) for w in record]

0 commit comments

Comments
 (0)