Require keyword args for data iterator. (#8327)

This commit is contained in:
Jiaming Yuan
2022-10-10 17:47:13 +08:00
committed by GitHub
parent e1f9f80df2
commit 5545c49cfc
2 changed files with 53 additions and 36 deletions

View File

@@ -198,6 +198,10 @@ class IteratorForTest(xgb.core.DataIter):
def next(self, input_data: Callable) -> int:
if self.it == len(self.X):
return 0
with pytest.raises(TypeError, match="keyword args"):
input_data(self.X[self.it], self.y[self.it], None)
# Use copy to make sure the iterator doesn't hold a reference to the data.
input_data(
data=self.X[self.it].copy(),