Пример #1
0
 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
Пример #2
0
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
Пример #3
0
 def fail3(value, state):
     raise err.ValidationError('third failure', interrupt_validation=False)
Пример #4
0
 def fail2(value, state):
     raise err.ValidationError('second failure', interrupt_validation=False)
Пример #5
0
 def fail1(value, state):
     raise err.ValidationError('first failure', interrupt_validation=False)
Пример #6
0
 def failing_processor(value, context):
     e = err.ValidationError("I'll fail you, no matter what",
                             interrupt_validation=False)
     raise e
Пример #7
0
 def proc(data, state):
     raise err.ValidationError('failure')
Пример #8
0
 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
Пример #9
0
 def test_has_interrupt_validation_attribute(self):
     try:
         raise err.ValidationError('test')
     except err.ValidationError as e:
         assert hasattr(e, 'interrupt_validation')