Example #1
0
def test_nth():
    assert nth(2, "ABCDE") == "C"
    assert nth(2, iter("ABCDE")) == "C"
    assert nth(1, (3, 2, 1)) == 2
    assert nth(0, {"foo": "bar"}) == "foo"
    assert raises(StopIteration, lambda: nth(10, {10: "foo"}))
Example #2
0
def test_nth():
    assert nth(2, 'ABCDE') == 'C'
    assert nth(1, (3, 2, 1)) == 2
Example #3
0
def test_nth():
    assert nth(2, "ABCDE") == "C"
    assert nth(2, iter("ABCDE")) == "C"
    assert nth(1, (3, 2, 1)) == 2
Example #4
0
def test_nth():
    assert nth(2, 'ABCDE') == 'C'
    assert nth(1, (3, 2, 1)) == 2