Skip to content

Commit 1c578c3

Browse files
Jason MokJason Mok
Jason Mok
authored and
Jason Mok
committed
Lint contribution
1 parent 806bb20 commit 1c578c3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pandas/tests/reshape/test_cut.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ def test_cut_with_nullable_int64():
790790

791791
tm.assert_series_equal(result, expected)
792792

793+
793794
def test_datetime_cut_notna():
794795
"""
795796
Ensure pd.cut can handle DatetimeArray without raising an AttributeError
@@ -800,20 +801,22 @@ def test_datetime_cut_notna():
800801
data = to_datetime(["2023-09-17", "2023-10-06"])
801802
datetime_array = data.array
802803

803-
bins = pd.date_range(start="2023-09-16", periods=3, freq='10D')
804+
bins = pd.date_range(start="2023-09-16", periods=3, freq="10D")
804805

805806
# Use pd.cut to categorize datetime data and capture the result
806807
result = pd.cut(datetime_array, bins=bins)
807808

808809
expected_intervals = IntervalIndex.from_arrays(
809-
[pd.Timestamp('2023-09-16'), pd.Timestamp('2023-09-26')],
810-
[pd.Timestamp('2023-09-26'), pd.Timestamp('2023-10-06')],
811-
closed='right'
810+
[pd.Timestamp("2023-09-16"), pd.Timestamp("2023-09-26")],
811+
[pd.Timestamp("2023-09-26"), pd.Timestamp("2023-10-06")],
812+
closed="right",
812813
)
813814

814815
expected = Series(expected_intervals).astype(CategoricalDtype(ordered=True))
815816

816817
tm.assert_categorical_equal(result.categories, expected.values)
817818

818-
assert not hasattr(result, 'notna'), "AttributeError related to 'notna' should not be present"
819-
assert len(result.categories) == 2, "There should be exactly 2 bins"
819+
assert not hasattr(
820+
result, "notna"
821+
), "AttributeError related to 'notna' should not be present"
822+
assert len(result.categories) == 2, "There should be exactly 2 bins"

0 commit comments

Comments
 (0)