Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pandas/tests/reshape/test_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,22 @@ def test_single_bin(data, length):
tm.assert_series_equal(result, expected)


@pytest.mark.parametrize(
"values,threshold",
[
([0.1, 0.1, 0.1], 0.001), # small positive values
([-0.1, -0.1, -0.1], 0.001), # negative values
([0.01, 0.01, 0.01], 0.0001), # very small values
],
)
def test_single_bin_edge_adjustment(values, threshold):
# gh-58517 - edge adjustment mutation when all values are same
result, bins = cut(values, 3, retbins=True)

bin_range = bins[-1] - bins[0]
assert bin_range < threshold


@pytest.mark.parametrize(
"array_1_writeable,array_2_writeable", [(True, True), (True, False), (False, False)]
)
Expand Down
Loading