def test_LazyList_laziness(self):

    def test(ll, idx, val, cache):
        self.assertEqual(ll[idx], val)
        self.assertEqual(getattr(ll, '_LazyList__cache'), list(cache))
    ll = LazyList(range(10))
    test(ll, 0, 0, range(1))
    test(ll, 5, 5, range(6))
    test(ll, (- 3), 7, range(10))
    ll = LazyList(range(10), reverse=True)
    test(ll, (- 1), 0, range(1))
    test(ll, 3, 6, range(10))
    ll = LazyList(itertools.count())
    test(ll, 10, 10, range(11))
    ll = reversed(ll)
    test(ll, (- 15), 14, range(15))
def test_LazyList_laziness(self):

    def test(ll, idx, val, cache):
        self.assertEqual(ll[idx], val)
        self.assertEqual(getattr(ll, '_LazyList__cache'), list(cache))
    ll = LazyList(range(10))
    test(ll, 0, 0, range(1))
    test(ll, 5, 5, range(6))
    test(ll, (- 3), 7, range(10))
    ll = LazyList(range(10), reverse=True)
    test(ll, (- 1), 0, range(1))
    test(ll, 3, 6, range(10))
    ll = LazyList(itertools.count())
    test(ll, 10, 10, range(11))
    ll = reversed(ll)
    test(ll, (- 15), 14, range(15))