mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Add filterfalse.__reduce__
This commit is contained in:
1 parent
6165aadcc4
commit
4f87f875fc
2 files changed
+9
-3
No files matched your search
Vendored
-2
@@ -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])
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in new issue
Block a user