#NEWLINE# def test_dictionary_defination_usage( ) : #NEWLINE# #INDENT# @ authorization_method #NEWLINE# def authorize( user , abilities ) : #NEWLINE# #INDENT# if user . is_admin : #NEWLINE# #INDENT# abilities . append ( MANAGE , ALL ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# abilities . append ( READ , ALL ) #NEWLINE# abilities . append ( EDIT , Article , author = user ) #NEWLINE# #UNINDENT# #UNINDENT# authorization_target ( User ) #NEWLINE# sally = User ( name = 'sally' , admin = False ) #NEWLINE# billy = User ( name = 'billy' , admin = True ) #NEWLINE# article = Article ( author = sally ) #NEWLINE# assert sally . can ( EDIT , article ) #NEWLINE# billys_article = Article ( author = article ) #NEWLINE# assert sally . cannot ( EDIT , billys_article ) #NEWLINE# assert billy . can ( EDIT , billys_article )