Skip to content

Commit e4e2d78

Browse files
Added integration tests
1 parent a3e00de commit e4e2d78

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

pandas/tests/test_integration.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
- pandas.core.series (Series construction)
66
- pandas.core.frame (DataFrame construction)
77
- pandas.core.dtypes (dtype handling)
8-
8+
- pandas.core.internals (internal data management)
9+
- pandas.util._validators (validation utilities)
10+
- pandas.core.missing (missing data handling)
911
"""
1012
import numpy as np
1113
import pytest
@@ -70,3 +72,49 @@ def test_dataframe_from_dict_mixed_series_dtypes(self):
7072
assert len(df) == 3
7173

7274

75+
class TestNithikeshIntegration:
76+
"""Integration tests by Nithikesh Bobbili covering validation-missing data interactions."""
77+
78+
def test_validate_fillna_with_clean_method(self):
79+
"""Test validate_fillna_kwargs delegates to clean_fill_method.
80+
81+
This exercises interaction between:
82+
- pandas.util._validators.validate_fillna_kwargs
83+
- pandas.core.missing.clean_fill_method
84+
- method normalization and validation
85+
"""
86+
# Test method normalization through validate_fillna_kwargs
87+
value, method = validate_fillna_kwargs(None, "pad")
88+
assert value is None
89+
assert method == clean_fill_method("pad")
90+
91+
# Test alternate method names
92+
value, method = validate_fillna_kwargs(None, "ffill")
93+
assert method == clean_fill_method("ffill")
94+
95+
# Both None should raise
96+
with pytest.raises(ValueError, match="Must specify a fill"):
97+
validate_fillna_kwargs(None, None)
98+
99+
def test_series_fillna_integration(self):
100+
"""Test Series.fillna() and ffill() use validation and missing data modules.
101+
102+
This exercises interaction between:
103+
- pandas.core.series.Series.fillna() / ffill()
104+
- pandas.util._validators.validate_fillna_kwargs (internally)
105+
- pandas.core.missing (fill methods)
106+
- pandas.core.internals (data modification)
107+
"""
108+
# Create Series with missing values
109+
s = Series([1.0, np.nan, 3.0, np.nan, 5.0])
110+
111+
# ffill uses forward fill method - interacts with missing data module
112+
result = s.ffill()
113+
expected = Series([1.0, 1.0, 3.0, 3.0, 5.0])
114+
pd.testing.assert_series_equal(result, expected)
115+
116+
# fillna with value - validation ensures value is acceptable
117+
result = s.fillna(value=0.0)
118+
expected = Series([1.0, 0.0, 3.0, 0.0, 5.0])
119+
pd.testing.assert_series_equal(result, expected)
120+

0 commit comments

Comments
 (0)