Skip to content

Commit ac83ba0

Browse files
authored
STYLE: Inconsistent namespace - dtypes (#39992) (#40161)
1 parent fb47a3d commit ac83ba0

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

pandas/tests/dtypes/test_dtypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ class TestCategoricalDtypeParametrized:
821821
np.arange(1000),
822822
["a", "b", 10, 2, 1.3, True],
823823
[True, False],
824-
pd.date_range("2017", periods=4),
824+
date_range("2017", periods=4),
825825
],
826826
)
827827
def test_basic(self, categories, ordered):

pandas/tests/dtypes/test_inference.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ def test_unicode(self):
808808
(object, None, True, "empty"),
809809
],
810810
)
811-
@pytest.mark.parametrize("box", [pd.Series, np.array])
811+
@pytest.mark.parametrize("box", [Series, np.array])
812812
def test_object_empty(self, box, missing, dtype, skipna, expected):
813813
# GH 23421
814814
arr = box([missing, missing], dtype=dtype)
@@ -915,7 +915,7 @@ def test_infer_dtype_period(self):
915915
arr = np.array([Period("2011-01", freq="D"), Period("2011-02", freq="M")])
916916
assert lib.infer_dtype(arr, skipna=True) == "period"
917917

918-
@pytest.mark.parametrize("klass", [pd.array, pd.Series, pd.Index])
918+
@pytest.mark.parametrize("klass", [pd.array, Series, Index])
919919
@pytest.mark.parametrize("skipna", [True, False])
920920
def test_infer_dtype_period_array(self, klass, skipna):
921921
# https://github.com/pandas-dev/pandas/issues/23553
@@ -1264,7 +1264,7 @@ def test_interval(self):
12641264
inferred = lib.infer_dtype(Series(idx), skipna=False)
12651265
assert inferred == "interval"
12661266

1267-
@pytest.mark.parametrize("klass", [pd.array, pd.Series])
1267+
@pytest.mark.parametrize("klass", [pd.array, Series])
12681268
@pytest.mark.parametrize("skipna", [True, False])
12691269
@pytest.mark.parametrize("data", [["a", "b", "c"], ["a", "b", pd.NA]])
12701270
def test_string_dtype(self, data, skipna, klass):
@@ -1273,7 +1273,7 @@ def test_string_dtype(self, data, skipna, klass):
12731273
inferred = lib.infer_dtype(val, skipna=skipna)
12741274
assert inferred == "string"
12751275

1276-
@pytest.mark.parametrize("klass", [pd.array, pd.Series])
1276+
@pytest.mark.parametrize("klass", [pd.array, Series])
12771277
@pytest.mark.parametrize("skipna", [True, False])
12781278
@pytest.mark.parametrize("data", [[True, False, True], [True, False, pd.NA]])
12791279
def test_boolean_dtype(self, data, skipna, klass):

pandas/tests/dtypes/test_missing.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,16 @@ def test_isna_datetime(self):
205205

206206
def test_isna_old_datetimelike(self):
207207
# isna_old should work for dt64tz, td64, and period, not just tznaive
208-
dti = pd.date_range("2016-01-01", periods=3)
208+
dti = date_range("2016-01-01", periods=3)
209209
dta = dti._data
210-
dta[-1] = pd.NaT
210+
dta[-1] = NaT
211211
expected = np.array([False, False, True], dtype=bool)
212212

213213
objs = [dta, dta.tz_localize("US/Eastern"), dta - dta, dta.to_period("D")]
214214

215215
for obj in objs:
216216
with cf.option_context("mode.use_inf_as_na", True):
217-
result = pd.isna(obj)
217+
result = isna(obj)
218218

219219
tm.assert_numpy_array_equal(result, expected)
220220

@@ -320,38 +320,38 @@ def test_period(self):
320320
def test_decimal(self):
321321
# scalars GH#23530
322322
a = Decimal(1.0)
323-
assert pd.isna(a) is False
324-
assert pd.notna(a) is True
323+
assert isna(a) is False
324+
assert notna(a) is True
325325

326326
b = Decimal("NaN")
327-
assert pd.isna(b) is True
328-
assert pd.notna(b) is False
327+
assert isna(b) is True
328+
assert notna(b) is False
329329

330330
# array
331331
arr = np.array([a, b])
332332
expected = np.array([False, True])
333-
result = pd.isna(arr)
333+
result = isna(arr)
334334
tm.assert_numpy_array_equal(result, expected)
335335

336-
result = pd.notna(arr)
336+
result = notna(arr)
337337
tm.assert_numpy_array_equal(result, ~expected)
338338

339339
# series
340340
ser = Series(arr)
341341
expected = Series(expected)
342-
result = pd.isna(ser)
342+
result = isna(ser)
343343
tm.assert_series_equal(result, expected)
344344

345-
result = pd.notna(ser)
345+
result = notna(ser)
346346
tm.assert_series_equal(result, ~expected)
347347

348348
# index
349349
idx = pd.Index(arr)
350350
expected = np.array([False, True])
351-
result = pd.isna(idx)
351+
result = isna(idx)
352352
tm.assert_numpy_array_equal(result, expected)
353353

354-
result = pd.notna(idx)
354+
result = notna(idx)
355355
tm.assert_numpy_array_equal(result, ~expected)
356356

357357

@@ -578,7 +578,7 @@ def _check_behavior(self, arr, expected):
578578
tm.assert_numpy_array_equal(result, expected)
579579

580580
def test_basic(self):
581-
arr = np.array([1, None, "foo", -5.1, pd.NaT, np.nan])
581+
arr = np.array([1, None, "foo", -5.1, NaT, np.nan])
582582
expected = np.array([False, True, False, False, True, True])
583583

584584
self._check_behavior(arr, expected)

0 commit comments

Comments
 (0)