Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_itertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,6 @@ def test_filter(self):
c = filter(isEven, range(6))
self.pickletest(proto, c)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_filterfalse(self):
self.assertEqual(list(filterfalse(isEven, range(6))), [1,3,5])
self.assertEqual(list(filterfalse(None, [0,1,0,2,0])), [0,0,0])
Expand Down
10 changes: 9 additions & 1 deletion vm/src/stdlib/itertools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,15 @@ mod decl {
}

#[pyimpl(with(IterNext, Constructor))]
impl PyItertoolsFilterFalse {}
impl PyItertoolsFilterFalse {
#[pymethod(magic)]
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (PyObjectRef, PyIter)) {
(
zelf.class().clone(),
(zelf.predicate.clone(), zelf.iterable.clone()),
)
}
}
impl IterNextIterable for PyItertoolsFilterFalse {}
impl IterNext for PyItertoolsFilterFalse {
fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> {
Expand Down