Skip to content

Commit

Permalink
Test dir of pandas.api.* (#52826)
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretLake committed Apr 23, 2023
1 parent 937f774 commit 4dd071e
Showing 1 changed file with 93 additions and 3 deletions.
96 changes: 93 additions & 3 deletions pandas/tests/api/test_api.py
Expand Up @@ -5,7 +5,13 @@
import pandas as pd
from pandas import api
import pandas._testing as tm
from pandas.api import typing as api_typing
from pandas.api import (
extensions as api_extensions,
indexers as api_indexers,
interchange as api_interchange,
types as api_types,
typing as api_typing,
)


class Base:
Expand Down Expand Up @@ -237,7 +243,13 @@ def test_depr(self):


class TestApi(Base):
allowed = ["types", "extensions", "indexers", "interchange", "typing"]
allowed_api_dirs = [
"types",
"extensions",
"indexers",
"interchange",
"typing",
]
allowed_typing = [
"DataFrameGroupBy",
"DatetimeIndexResamplerGroupby",
Expand All @@ -256,13 +268,91 @@ class TestApi(Base):
"TimeGrouper",
"Window",
]
allowed_api_types = [
"is_any_real_numeric_dtype",
"is_array_like",
"is_bool",
"is_bool_dtype",
"is_categorical_dtype",
"is_complex",
"is_complex_dtype",
"is_datetime64_any_dtype",
"is_datetime64_dtype",
"is_datetime64_ns_dtype",
"is_datetime64tz_dtype",
"is_dict_like",
"is_dtype_equal",
"is_extension_array_dtype",
"is_file_like",
"is_float",
"is_float_dtype",
"is_hashable",
"is_int64_dtype",
"is_integer",
"is_integer_dtype",
"is_interval",
"is_interval_dtype",
"is_iterator",
"is_list_like",
"is_named_tuple",
"is_number",
"is_numeric_dtype",
"is_object_dtype",
"is_period_dtype",
"is_re",
"is_re_compilable",
"is_scalar",
"is_signed_integer_dtype",
"is_sparse",
"is_string_dtype",
"is_timedelta64_dtype",
"is_timedelta64_ns_dtype",
"is_unsigned_integer_dtype",
"pandas_dtype",
"infer_dtype",
"union_categoricals",
"CategoricalDtype",
"DatetimeTZDtype",
"IntervalDtype",
"PeriodDtype",
]
allowed_api_interchange = ["from_dataframe", "DataFrame"]
allowed_api_indexers = [
"check_array_indexer",
"BaseIndexer",
"FixedForwardWindowIndexer",
"VariableOffsetWindowIndexer",
]
allowed_api_extensions = [
"no_default",
"ExtensionDtype",
"register_extension_dtype",
"register_dataframe_accessor",
"register_index_accessor",
"register_series_accessor",
"take",
"ExtensionArray",
"ExtensionScalarOpsMixin",
]

def test_api(self):
self.check(api, self.allowed)
self.check(api, self.allowed_api_dirs)

def test_api_typing(self):
self.check(api_typing, self.allowed_typing)

def test_api_types(self):
self.check(api_types, self.allowed_api_types)

def test_api_interchange(self):
self.check(api_interchange, self.allowed_api_interchange)

def test_api_indexers(self):
self.check(api_indexers, self.allowed_api_indexers)

def test_api_extensions(self):
self.check(api_extensions, self.allowed_api_extensions)


class TestTesting(Base):
funcs = [
Expand Down

0 comments on commit 4dd071e

Please sign in to comment.