Skip to content

Commit 4dd071e

Browse files
authored
Test dir of pandas.api.* (#52826)
1 parent 937f774 commit 4dd071e

File tree

1 file changed

+93
-3
lines changed

1 file changed

+93
-3
lines changed

pandas/tests/api/test_api.py

+93-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
import pandas as pd
66
from pandas import api
77
import pandas._testing as tm
8-
from pandas.api import typing as api_typing
8+
from pandas.api import (
9+
extensions as api_extensions,
10+
indexers as api_indexers,
11+
interchange as api_interchange,
12+
types as api_types,
13+
typing as api_typing,
14+
)
915

1016

1117
class Base:
@@ -237,7 +243,13 @@ def test_depr(self):
237243

238244

239245
class TestApi(Base):
240-
allowed = ["types", "extensions", "indexers", "interchange", "typing"]
246+
allowed_api_dirs = [
247+
"types",
248+
"extensions",
249+
"indexers",
250+
"interchange",
251+
"typing",
252+
]
241253
allowed_typing = [
242254
"DataFrameGroupBy",
243255
"DatetimeIndexResamplerGroupby",
@@ -256,13 +268,91 @@ class TestApi(Base):
256268
"TimeGrouper",
257269
"Window",
258270
]
271+
allowed_api_types = [
272+
"is_any_real_numeric_dtype",
273+
"is_array_like",
274+
"is_bool",
275+
"is_bool_dtype",
276+
"is_categorical_dtype",
277+
"is_complex",
278+
"is_complex_dtype",
279+
"is_datetime64_any_dtype",
280+
"is_datetime64_dtype",
281+
"is_datetime64_ns_dtype",
282+
"is_datetime64tz_dtype",
283+
"is_dict_like",
284+
"is_dtype_equal",
285+
"is_extension_array_dtype",
286+
"is_file_like",
287+
"is_float",
288+
"is_float_dtype",
289+
"is_hashable",
290+
"is_int64_dtype",
291+
"is_integer",
292+
"is_integer_dtype",
293+
"is_interval",
294+
"is_interval_dtype",
295+
"is_iterator",
296+
"is_list_like",
297+
"is_named_tuple",
298+
"is_number",
299+
"is_numeric_dtype",
300+
"is_object_dtype",
301+
"is_period_dtype",
302+
"is_re",
303+
"is_re_compilable",
304+
"is_scalar",
305+
"is_signed_integer_dtype",
306+
"is_sparse",
307+
"is_string_dtype",
308+
"is_timedelta64_dtype",
309+
"is_timedelta64_ns_dtype",
310+
"is_unsigned_integer_dtype",
311+
"pandas_dtype",
312+
"infer_dtype",
313+
"union_categoricals",
314+
"CategoricalDtype",
315+
"DatetimeTZDtype",
316+
"IntervalDtype",
317+
"PeriodDtype",
318+
]
319+
allowed_api_interchange = ["from_dataframe", "DataFrame"]
320+
allowed_api_indexers = [
321+
"check_array_indexer",
322+
"BaseIndexer",
323+
"FixedForwardWindowIndexer",
324+
"VariableOffsetWindowIndexer",
325+
]
326+
allowed_api_extensions = [
327+
"no_default",
328+
"ExtensionDtype",
329+
"register_extension_dtype",
330+
"register_dataframe_accessor",
331+
"register_index_accessor",
332+
"register_series_accessor",
333+
"take",
334+
"ExtensionArray",
335+
"ExtensionScalarOpsMixin",
336+
]
259337

260338
def test_api(self):
261-
self.check(api, self.allowed)
339+
self.check(api, self.allowed_api_dirs)
262340

263341
def test_api_typing(self):
264342
self.check(api_typing, self.allowed_typing)
265343

344+
def test_api_types(self):
345+
self.check(api_types, self.allowed_api_types)
346+
347+
def test_api_interchange(self):
348+
self.check(api_interchange, self.allowed_api_interchange)
349+
350+
def test_api_indexers(self):
351+
self.check(api_indexers, self.allowed_api_indexers)
352+
353+
def test_api_extensions(self):
354+
self.check(api_extensions, self.allowed_api_extensions)
355+
266356

267357
class TestTesting(Base):
268358
funcs = [

0 commit comments

Comments
 (0)