Skip to content

Commit 0a3577e

Browse files
AmirAmir
authored andcommitted
Modified top-level name object on CategoricalDtype class by importing the set module decorator and decorating the class. Tested the modification by adding an assert statement to the already existing test_set_module test function
1 parent 23c497b commit 0a3577e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pandas/core/dtypes/dtypes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from pandas._libs.tslibs.offsets import BDay
4949
from pandas.compat import pa_version_under10p1
5050
from pandas.errors import PerformanceWarning
51+
from pandas.util._decorators import set_module
5152
from pandas.util._exceptions import find_stack_level
5253

5354
from pandas.core.dtypes.base import (
@@ -155,6 +156,7 @@ class CategoricalDtypeType(type):
155156

156157

157158
@register_extension_dtype
159+
@set_module("pandas")
158160
class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
159161
"""
160162
Type for categorical data with the categories and orderedness.

pandas/tests/api/test_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,4 @@ def test_util_in_top_level(self):
400400

401401
def test_set_module():
402402
assert pd.DataFrame.__module__ == "pandas"
403+
assert pd.CategoricalDtype.__module__ == "pandas"

0 commit comments

Comments
 (0)