def assert_grammar_validation(grammar_errors, test_obj):
 for (attr, value, error, message) in grammar_errors:
  with nt.assert_raises(error) as err:
   setattr(test_obj, attr, value)
  nt.assert_equal(err.exception.args[0], message)

def assert_grammar_validation ( grammar_errors , test_obj ) : for ( attr , value , error , message ) in grammar_errors : with nt . assert_raises ( error ) as err : setattr ( test_obj , attr , value ) nt . assert_equal ( err . exception . args [ 0 ] , message )
check grammar methods for validation errors .