예제 #1
0
def test_multi_subscription3():
    it = slicing((0, 1, 2.3, 4, 5), 10)
    assert next(it) == 0
    assert next(it) == 1
    with pytest.raises(TypeError):
        next(it)
    # assert next(it) == 4
    # assert next(it) == 5
    with pytest.raises(StopIteration):
        next(it)
    with pytest.raises(StopIteration):
        next(it)
예제 #2
0
def test_slicing2():
    assert_slicing(slicing(s[:3], 10), range(10)[:3])
예제 #3
0
def test_multi_subscription2():
    assert_slicing(slicing((4, 2, 1, -2, 5), 10), [4, 2, 1, 8, 5])
예제 #4
0
def test_slicing9():
    assert_slicing(slicing(s[10:0], 10), range(10)[10:0])
예제 #5
0
def test_slicing13():
    assert_slicing(slicing(s[8::-2], 10), range(10)[8::-2])
예제 #6
0
def test_slicing5():
    assert_slicing(slicing(s[::2], 10), range(10)[::2])
예제 #7
0
def test_slicing7():
    assert_slicing(slicing(s[100::2], 10), range(10)[100::2])
예제 #8
0
def test_subscription1():
    assert_slicing(slicing(0, 10), [0])
예제 #9
0
def test_subscription2():
    assert_slicing(slicing(-1, 10), [9])
예제 #10
0
def test_slicing17():
    assert_slicing(slicing(s[8:4:-1], 10), range(10)[8:4:-1])
예제 #11
0
def test_multi_slicing1():
    assert_slicing(slicing(s[2:4:8, 3, 8:2:-1], 10),
                   chain(range(10)[2:4:8], [range(10)[3]],
                         range(10)[8:2:-1]))
예제 #12
0
def test_slicing16():
    assert_slicing(slicing(s[:4:-1], 10), range(10)[:4:-1])
예제 #13
0
def test_slicing15():
    assert_slicing(slicing(s[:3:-1], 10), range(10)[:3:-1])
예제 #14
0
def test_slicing14():
    assert_slicing(slicing(s[7::-2], 10), range(10)[7::-2])
예제 #15
0
def test_slicing3():
    assert_slicing(slicing(s[:], 4), range(4)[:])
예제 #16
0
def test_subscription3():
    assert_slicing(slicing(-2, 10), [8])
예제 #17
0
def test_slicing4():
    assert_slicing(slicing(s[2:], 4), range(4)[2:])
예제 #18
0
def test_subscription4():
    assert_slicing(slicing(9, 10), [9])
예제 #19
0
def test_slicing6():
    assert_slicing(slicing(s[1::2], 10), range(10)[1::2])
예제 #20
0
def test_subscription5():
    with pytest.raises(TypeError):
        list(slicing(1.2, 10))
예제 #21
0
def test_slicing8():
    assert_slicing(slicing(s[1:10:3], 10), range(10)[1:10:3])
예제 #22
0
def test_multi_subscription1():
    assert_slicing(slicing((1, -1), 10), [1, 9])
예제 #23
0
def test_slicing10():
    assert_slicing(slicing(s[8:3], 10), range(10)[8:3])
예제 #24
0
def test_slicing12():
    assert_slicing(slicing(s[::-3], 10), range(10)[::-3])