| 198 | |
| 199 | |
| 200 | class IterForCacheTest(xgb.DataIter): |
| 201 | def __init__( |
| 202 | self, x: np.ndarray, y: np.ndarray, w: np.ndarray, release_data: bool |
| 203 | ) -> None: |
| 204 | self.kwargs = {"data": x, "label": y, "weight": w} |
| 205 | super().__init__(release_data=release_data) |
| 206 | |
| 207 | def next(self, input_data: Callable) -> bool: |
| 208 | if self.it == 1: |
| 209 | return False |
| 210 | self.it += 1 |
| 211 | input_data(**self.kwargs) |
| 212 | return True |
| 213 | |
| 214 | def reset(self) -> None: |
| 215 | self.it = 0 |
| 216 | |
| 217 | |
| 218 | def test_data_cache() -> None: |
no outgoing calls