Skip to content

Commit 2ebdcd0

Browse files
committed
Fix formatting
1 parent 7bc0f6f commit 2ebdcd0

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

pandas/tests/test_algos.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,58 +2037,59 @@ def test_diff_invalid_type_handling(self):
20372037
"""Test that diff function properly handles invalid input types"""
20382038
# Test for the bug fix where non-numeric types would raise AttributeError
20392039
# instead of ValueError
2040-
2040+
20412041
# Create a simple array for testing
20422042
arr = np.array([1, 2, 3, 4, 5])
2043-
2043+
20442044
# Test cases that should raise ValueError (not AttributeError)
20452045
invalid_inputs = [
20462046
"hello", # string
2047-
None, # None
2048-
[1, 2], # list
2047+
None, # None
2048+
[1, 2], # list
20492049
{"key": "value"}, # dict
2050-
object(), # generic object
2050+
object(), # generic object
20512051
]
2052-
2052+
20532053
for invalid_input in invalid_inputs:
20542054
with pytest.raises(ValueError, match="periods must be an integer"):
20552055
algos.diff(arr, invalid_input)
2056-
2056+
20572057
def test_diff_valid_float_handling(self):
20582058
"""Test that diff function properly handles valid float inputs"""
2059-
2059+
20602060
# Create a simple array for testing
20612061
arr = np.array([1, 2, 3, 4, 5])
2062-
2062+
20632063
# Test cases that should work (float values that are integers)
20642064
valid_inputs = [
2065-
1.0, # float that is an integer
2066-
2.0, # another float that is an integer
2065+
1.0, # float that is an integer
2066+
2.0, # another float that is an integer
20672067
-1.0, # negative float that is an integer
20682068
]
2069-
2069+
20702070
for valid_input in valid_inputs:
20712071
# Should not raise an exception
20722072
result = algos.diff(arr, valid_input)
20732073
assert result.shape == arr.shape
2074-
2074+
20752075
def test_diff_invalid_float_handling(self):
20762076
"""Test that diff function properly handles invalid float inputs"""
2077-
2077+
20782078
# Create a simple array for testing
20792079
arr = np.array([1, 2, 3, 4, 5])
2080-
2080+
20812081
# Test cases that should raise ValueError (float values that are not integers)
20822082
invalid_float_inputs = [
2083-
1.5, # float that is not an integer
2084-
2.7, # another float that is not an integer
2083+
1.5, # float that is not an integer
2084+
2.7, # another float that is not an integer
20852085
-1.3, # negative float that is not an integer
20862086
]
2087-
2087+
20882088
for invalid_input in invalid_float_inputs:
20892089
with pytest.raises(ValueError, match="periods must be an integer"):
20902090
algos.diff(arr, invalid_input)
20912091

2092+
20922093
@pytest.mark.parametrize("op", [np.array, pd.array])
20932094
def test_union_with_duplicates(op):
20942095
# GH#36289

0 commit comments

Comments
 (0)