def test_other_c_funcs_failures(): with pytest.raises(TypeError): # no argument given. iteration_utilities.return_first_arg() with pytest.raises(TypeError): # no positional argument given. iteration_utilities.return_first_arg(test=10) x = object() with pytest.raises(TypeError): iteration_utilities.is_even(x) with pytest.raises(TypeError): iteration_utilities.is_odd(x) class NoBoolWithMod(_hf.FailBool): def __mod__(self, other): return self with pytest.raises(_hf.FailBool.EXC_TYP, match=_hf.FailBool.EXC_MSG): iteration_utilities.is_even(NoBoolWithMod()) with pytest.raises(_hf.FailBool.EXC_TYP, match=_hf.FailBool.EXC_MSG): iteration_utilities.is_odd(NoBoolWithMod()) with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): iteration_utilities.is_iterable(_hf.FailIter())
def test_merge_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: merge(_hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_unique_justseen_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): unique_justseen(_hf.FailIter())
def test_argmin_failure10(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: argmin(_hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_starfilter_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: starfilter(operator.eq, _hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_all_monotone_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): all_monotone(_hf.FailIter())
def test_sideeffects_failure2(): l = [] with pytest.raises(_hf.FailIter.EXC_TYP) as exc: sideeffects(_hf.FailIter(), l.append, 1) assert _hf.FailIter.EXC_MSG in str(exc)
def test_roundrobin_failure2(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): roundrobin([T(1)], _hf.FailIter())
def test_replicate_failure2(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: replicate(_hf.FailIter(), 2) assert _hf.FailIter.EXC_MSG in str(exc)
def test_successive_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: successive(_hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_duplicates_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: duplicates(_hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_deepflatten_failure7(): # object that raises something else than TypeError when not iterable with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): list(deepflatten([T(1), _hf.FailIter(), T(3), T(4)]))
def test_deepflatten_failure5(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): deepflatten(_hf.FailIter())
def test_merge_failure2(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: merge([T(10), T(20)], _hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_allisinstance_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: all_isinstance(_hf.FailIter(), T) assert _hf.FailIter.EXC_MSG in str(exc)
def test_partition_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): partition(_hf.FailIter())
def test_starfilter_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): starfilter(operator.eq, _hf.FailIter())
def test_groupedby_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: groupedby(_hf.FailIter(), key=len) assert _hf.FailIter.EXC_MSG in str(exc)
def test_intersperse_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): intersperse(_hf.FailIter(), T(0))
def test_merge_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): merge(_hf.FailIter())
def test_nth_failures1(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: nth(10)(_hf.FailIter()) assert _hf.FailIter.EXC_MSG in str(exc)
def test_merge_failure2(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): merge([T(10), T(20)], _hf.FailIter())
def test_always_iterable_fails_with_non_typeerror_when_iter(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): always_iterable(_hf.FailIter())
def test_allisinstance_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): all_isinstance(_hf.FailIter(), T)
def test_grouper_failure3(): with pytest.raises(_hf.FailIter.EXC_TYP) as exc: grouper(_hf.FailIter(), 2) assert _hf.FailIter.EXC_MSG in str(exc)
def test_split_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): split(_hf.FailIter(), lambda x: False)
def test_duplicates_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): duplicates(_hf.FailIter())
def test_argmin_failure10(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): argmin(_hf.FailIter())
def test_groupedby_failure1(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): groupedby(_hf.FailIter(), key=len)
def test_replicate_failure2(): with pytest.raises(_hf.FailIter.EXC_TYP, match=_hf.FailIter.EXC_MSG): replicate(_hf.FailIter(), 2)