Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/itertools/test/test_itertools.py::AppTestItertools::()::test_islice

self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0ea32ad0>

    def test_islice(self):
            import itertools
    
            it = itertools.islice([], 0)
            raises(StopIteration, next, it)
    
            it = itertools.islice([1, 2, 3], 0)
            raises(StopIteration, next, it)
    
            it = itertools.islice([1, 2, 3, 4, 5], 3)
            for x in [1, 2, 3]:
                assert next(it) == x
            raises(StopIteration, next, it)
    
            it = itertools.islice([1, 2, 3, 4, 5], 1, 3)
            for x in [2, 3]:
                assert next(it) == x
            raises(StopIteration, next, it)
    
            it = itertools.islice([1, 2, 3, 4, 5], 0, 3, 2)
            for x in [1, 3]:
                assert next(it) == x
            raises(StopIteration, next, it)
    
            # Do not allow floats
            raises(ValueError, itertools.islice, [1, 2, 3, 4, 5], 0.0, 3.0, 2.0)
    
            it = itertools.islice([1, 2, 3], 0, None)
            for x in [1, 2, 3]:
                assert next(it) == x
            raises(StopIteration, next, it)
    
            assert list(itertools.islice(range(100), 10, 3)) == []
    
            # new in 2.5: start=None or step=None
            assert list(itertools.islice(range(10), None)) == list(range(10))
            assert list(itertools.islice(range(10), None,None)) == list(range(10))
            assert list(itertools.islice(range(10), None,None,None)) == list(range(10))
    
            it = itertools.islice([0, 1, 2], None, None, 2)
            assert list(it) == [0, 2]
    
>           import weakref
E           (application-level) BlockingIOError: [Errno 11] Resource temporarily unavailable: '/buildbot/slave/own-linux-x86-32/build/lib_pypy'

[/buildbot/slave/own-linux-x86-32/build/pypy/module/itertools/test/test_itertools.py:285]:43: BlockingIOError
builder: own-linux-x86-32 build #9460+
test: pypy/module/itertools/test/test_itertools.py::AppTestItertools::()::test_islice