def test_empty_flag_true_if_has_errors(self): stack = err.ValidationErrorStack('stack') assert stack.empty stack.append(err.ValidationError('new error')) assert not stack.empty e = stack.pop() assert stack.empty
def e_stack(): rv = err.ValidationErrorStack('Stack of errors') for i in range(5): try: raise err.ValidationError('error ' + str(i)) except err.ValidationError as e: rv.append(e) return rv
def fail3(value, state): raise err.ValidationError('third failure', interrupt_validation=False)
def fail2(value, state): raise err.ValidationError('second failure', interrupt_validation=False)
def fail1(value, state): raise err.ValidationError('first failure', interrupt_validation=False)
def failing_processor(value, context): e = err.ValidationError("I'll fail you, no matter what", interrupt_validation=False) raise e
def proc(data, state): raise err.ValidationError('failure')
def test_can_be_cleared(self): stack = err.ValidationErrorStack('stack') stack.append(err.ValidationError('new error')) assert not stack.empty stack.clear() assert stack.empty
def test_has_interrupt_validation_attribute(self): try: raise err.ValidationError('test') except err.ValidationError as e: assert hasattr(e, 'interrupt_validation')