|
5 | 5 | - pandas.core.series (Series construction) |
6 | 6 | - pandas.core.frame (DataFrame construction) |
7 | 7 | - 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) |
9 | 11 | """ |
10 | 12 | import numpy as np |
11 | 13 | import pytest |
@@ -70,3 +72,49 @@ def test_dataframe_from_dict_mixed_series_dtypes(self): |
70 | 72 | assert len(df) == 3 |
71 | 73 |
|
72 | 74 |
|
| 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