diff --git a/pandas/tests/util/test_hashing.py b/pandas/tests/util/test_hashing.py index 0dff252732274..00dc184a0ac4d 100644 --- a/pandas/tests/util/test_hashing.py +++ b/pandas/tests/util/test_hashing.py @@ -243,14 +243,14 @@ def test_categorical_consistency(s1, categorize): tm.assert_series_equal(h1, h3) -def test_categorical_with_nan_consistency(unit): - dti = pd.date_range("2012-01-01", periods=5, name="B", unit=unit) - cat = pd.Categorical.from_codes([-1, 0, 1, 2, 3, 4], categories=dti) - expected = hash_array(cat, categorize=False) - - ts = pd.Timestamp("2012-01-01").as_unit(unit) - cat2 = pd.Categorical.from_codes([-1, 0], categories=[ts]) - result = hash_array(cat2, categorize=False) +def test_categorical_with_nan_consistency(): + c = pd.Categorical.from_codes( + [-1, 0, 1, 2, 3, 4], categories=pd.date_range("2012-01-01", periods=5, name="B") + ) + expected = hash_array(c, categorize=False) + + c = pd.Categorical.from_codes([-1, 0], categories=[pd.Timestamp("2012-01-01")]) + result = hash_array(c, categorize=False) assert result[0] in expected assert result[1] in expected