11import pandas as pd
22import pandas ._testing as tm
3- from pandas .core .accessor import DataFrameAccessorLoader
3+ from pandas .core .accessor import AccessorEntryPointLoader
44
55
66def test_no_accessors (monkeypatch ):
@@ -13,7 +13,7 @@ def mock_entry_points(*, group):
1313 # Patch entry_points in the correct module
1414 monkeypatch .setattr ("pandas.core.accessor.entry_points" , mock_entry_points )
1515
16- DataFrameAccessorLoader .load ()
16+ AccessorEntryPointLoader .load ()
1717
1818
1919def test_load_dataframe_accessors (monkeypatch ):
@@ -34,14 +34,14 @@ def test_method(self):
3434
3535 # Mock entry_points
3636 def mock_entry_points (* , group ):
37- if group == DataFrameAccessorLoader .ENTRY_POINT_GROUP :
37+ if group == AccessorEntryPointLoader .ENTRY_POINT_GROUP :
3838 return [MockEntryPoint ()]
3939 return []
4040
4141 # Patch entry_points in the correct module
4242 monkeypatch .setattr ("pandas.core.accessor.entry_points" , mock_entry_points )
4343
44- DataFrameAccessorLoader .load ()
44+ AccessorEntryPointLoader .load ()
4545
4646 # Create DataFrame and verify that the accessor was registered
4747 df = pd .DataFrame ({"a" : [1 , 2 , 3 ]})
@@ -80,18 +80,18 @@ def which(self):
8080 return Accessor2
8181
8282 def mock_entry_points (* , group ):
83- if group == DataFrameAccessorLoader .ENTRY_POINT_GROUP :
83+ if group == AccessorEntryPointLoader .ENTRY_POINT_GROUP :
8484 return [MockEntryPoint1 (), MockEntryPoint2 ()]
8585 return []
8686
8787 monkeypatch .setattr ("pandas.core.accessor.entry_points" , mock_entry_points )
8888
8989 # Check that the UserWarning is raised
9090 with tm .assert_produces_warning (UserWarning , match = "duplicate_accessor" ) as record :
91- DataFrameAccessorLoader .load ()
91+ AccessorEntryPointLoader .load ()
9292
9393 messages = [str (w .message ) for w in record ]
94- assert any ("two packages with the same name" in msg for msg in messages )
94+ assert any ("you have two packages with the same name: " in msg for msg in messages )
9595
9696 df = pd .DataFrame ({"x" : [1 , 2 , 3 ]})
9797 assert hasattr (df , "duplicate_accessor" )
@@ -129,15 +129,15 @@ def which(self):
129129 return Accessor2
130130
131131 def mock_entry_points (* , group ):
132- if group == DataFrameAccessorLoader .ENTRY_POINT_GROUP :
132+ if group == AccessorEntryPointLoader .ENTRY_POINT_GROUP :
133133 return [MockEntryPoint1 (), MockEntryPoint2 ()]
134134 return []
135135
136136 monkeypatch .setattr ("pandas.core.accessor.entry_points" , mock_entry_points )
137137
138138 # Check that no UserWarning is raised
139139 with tm .assert_produces_warning (None , check_stacklevel = False ):
140- DataFrameAccessorLoader .load ()
140+ AccessorEntryPointLoader .load ()
141141
142142 df = pd .DataFrame ({"x" : [1 , 2 , 3 ]})
143143 assert hasattr (df , "accessor1" ), "Accessor1 not registered"
@@ -191,15 +191,15 @@ def which(self):
191191 return Accessor3
192192
193193 def mock_entry_points (* , group ):
194- if group == DataFrameAccessorLoader .ENTRY_POINT_GROUP :
194+ if group == AccessorEntryPointLoader .ENTRY_POINT_GROUP :
195195 return [MockEntryPoint1 (), MockEntryPoint2 (), MockEntryPoint3 ()]
196196 return []
197197
198198 monkeypatch .setattr ("pandas.core.accessor.entry_points" , mock_entry_points )
199199
200200 # Capture warnings
201201 with tm .assert_produces_warning (UserWarning , match = "duplicate_accessor" ) as record :
202- DataFrameAccessorLoader .load ()
202+ AccessorEntryPointLoader .load ()
203203
204204 messages = [str (w .message ) for w in record ]
205205
0 commit comments