Пример #1
0
def critique_raises(exception_class, pickle, *args, **kwargs):
    """
    Verifies that critiquing the raises the given exception and returns all
    exceptions the critique produces.

    Tries to run both as normal critique (fail fast) and slow critique (collect
    as many errors as possible). Returns the CritiqueException raised by the
    latter for inspection.
    """
    with raises(exception_class) as excinfo:
        a.critique(pickle, *args, **kwargs)
    assert not isinstance(excinfo.value, a.CritiqueException)

    with raises(a.CritiqueException) as excinfo:
        a.critique(pickle, *args, **dict(kwargs, fail_fast=False))
    e = excinfo.value
    assert isinstance(e, a.CritiqueException)
    assert all(isinstance(i, a.PickleException) for i in e.issues)
    assert isinstance(e.issues[0], exception_class)
    return e
Пример #2
0
def test_just_a_string():
    p = proto_op() + string_op + STOP
    assert a.critique(p) is None