Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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()))
Ejemplo n.º 7
0
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))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)))
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 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]))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 17
0
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()))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 22
0
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)
Ejemplo n.º 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())
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 26
0
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()))
Ejemplo n.º 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()))
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 30
0
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)