Add filterfalse.__reduce__

This commit is contained in:
Alexander Scharinger committed 2022-05-26 00:07:17 +02:00
1 parent 6165aadcc4
commit 4f87f875fc
2 files changed
+9 -3

No files matched your search

-2
View File
@@ -883,8 +883,6 @@ class TestBasicOps(unittest.TestCase):
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])
+9 -1
View File
@@ -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> {