Beispiel #1
0
def test_merge_failure13():
    # Test that a failing iterator doesn't raise a SystemError
    mge = merge(_hf.FailNext(offset=2, repeats=10))
    assert next(mge) == T(1)
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(mge)
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #2
0
def test_count_failure3():
    # Regression test when accessing the next item of the iterable resulted
    # in an Exception. For example when the iterable was a filter and the
    # filter function threw an exception.
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        count_items(_hf.FailNext())
    assert _hf.FailNext.EXC_MSG in str(exc)
def test_roundrobin_failure5():
    # Test that a failing iterator doesn't raise a SystemError
    rr = roundrobin(_hf.FailNext(offset=1, repeats=10),
                    [T(1), T(2), T(3), T(4)])
    assert next(rr) == T(1)
    assert next(rr) == T(1)
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(rr)
Beispiel #4
0
def test_allisinstance_failure3():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        all_isinstance(_hf.FailNext(), T)
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #5
0
def test_starfilter_failure8():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(starfilter(operator.ne, _hf.FailNext()))
def test_unique_justseen_failure4():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(unique_justseen(_hf.FailNext()))
def test_minmax_failure13():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        minmax(_hf.FailNext(offset=1))
Beispiel #8
0
def test_starfilter_failure8():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(starfilter(operator.ne, _hf.FailNext()))
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #9
0
def test_argmin_failure9():
    # Test that a failing iterator doesn't raise a SystemError
    # with default
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        argmin(_hf.FailNext(), default=1)
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #10
0
def test_intersperse_failure2():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(intersperse(_hf.FailNext(), T(0)))
Beispiel #11
0
def test_replicate_failure5():
    # iterator throws an exception different from StopIteration
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        list(replicate(_hf.FailNext(), 2))
Beispiel #12
0
def test_duplicates_failure3():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(duplicates(_hf.FailNext()))
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #13
0
def test_successive_failure3():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(successive(_hf.FailNext(), 1))
    assert _hf.FailNext.EXC_MSG in str(exc)
def test_deepflatten_failure4():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(deepflatten([[_hf.FailNext()], 2]))
Beispiel #15
0
def test_intersperse_failure2():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(intersperse(_hf.FailNext(), T(0)))
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #16
0
def test_merge_failure12():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(merge([T(1), T(1)], _hf.FailNext()))
    assert _hf.FailNext.EXC_MSG in str(exc)
def test_roundrobin_failure4():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        list(roundrobin([T(1), T(2)], _hf.FailNext()))
Beispiel #18
0
def test_nth_failures6():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        nth(1)(_hf.FailNext())
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #19
0
def test_replicate_failure5():
    # iterator throws an exception different from StopIteration
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        list(replicate(_hf.FailNext(), 2))
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #20
0
def test_split_failure8():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(split(_hf.FailNext(), iteration_utilities.return_False))
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #21
0
def test_sideeffects_failure7():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        list(sideeffects(_hf.FailNext(), lambda x: x))
    assert _hf.FailNext.EXC_MSG in str(exc)
def test_partition_failure5():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        partition(_hf.FailNext(), bool)
Beispiel #23
0
def test_all_monotone_failure3():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        all_monotone(_hf.FailNext())
Beispiel #24
0
def test_groupedby_failure8():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        groupedby(_hf.FailNext(), bool)
    assert _hf.FailNext.EXC_MSG in str(exc)
Beispiel #25
0
def test_grouper_failure5():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP) as exc:
        next(grouper(_hf.FailNext(offset=1), 2))
    assert _hf.FailNext.EXC_MSG in str(exc)
def test_merge_failure12():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(merge([T(1), T(1)], _hf.FailNext()))
Beispiel #27
0
def test_duplicates_failure3():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(duplicates(_hf.FailNext()))
Beispiel #28
0
def test_split_failure9():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        next(split(_hf.FailNext(offset=1), iteration_utilities.return_False))
Beispiel #29
0
def test_groupedby_failure8():
    # Test that a failing iterator doesn't raise a SystemError
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        groupedby(_hf.FailNext(), bool)
def test_argmin_failure9():
    # Test that a failing iterator doesn't raise a SystemError
    # with default
    with pytest.raises(_hf.FailNext.EXC_TYP, match=_hf.FailNext.EXC_MSG):
        argmin(_hf.FailNext(), default=1)