<s> """<STR_LIT>""" <EOL> from evennia . utils . test_resources import EvenniaTest <EOL> try : <EOL> from django . utils . unittest import TestCase <EOL> except ImportError : <EOL> from django . test import TestCase <EOL> from evennia . locks import lockfuncs <EOL> class TestLockCheck ( EvenniaTest ) : <EOL> def testrun ( self ) : <EOL> dbref = self . obj2 . dbref <EOL> self . obj1 . locks . add ( "<STR_LIT>" % ( dbref , dbref , dbref ) ) <EOL> self . obj2 . permissions . add ( '<STR_LIT>' ) <EOL> self . assertEquals ( True , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' ) ) <EOL> self . obj1 . locks . add ( "<STR_LIT>" ) <EOL> self . assertEquals ( False , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , self . obj1 . locks . check ( self . obj2 , '<STR_LIT>' , default = True ) ) <EOL> class TestLockfuncs ( EvenniaTest ) : <EOL> def testrun ( self ) : <EOL> self . obj2 . permissions . add ( '<STR_LIT>' ) <EOL> self . assertEquals ( True , lockfuncs . true ( self . obj2 , self . obj1 ) ) <EOL> self . assertEquals ( False , lockfuncs . false ( self . obj2 , self . obj1 ) ) <EOL> self . assertEquals ( True , lockfuncs . perm ( self . obj2 , self . obj1 , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , lockfuncs . perm_above ( self . obj2 , self . obj1 , '<STR_LIT>' ) ) <EOL> dbref = self . obj2 . dbref <EOL> self . assertEquals ( True , lockfuncs . dbref ( self . obj2 , self . obj1 , '<STR_LIT:%s>' % dbref ) ) <EOL> self . obj2 . db . testattr = <NUM_LIT> <EOL> self . assertEquals ( True , lockfuncs . attr ( self . obj2 , self . obj1 , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEquals ( False , lockfuncs . attr_gt ( self . obj2 , self . obj1 , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , lockfuncs . attr_ge ( self . obj2 , self . obj1 , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEquals ( False , lockfuncs . attr_lt ( self . obj2 , self . obj1 , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEquals ( True , lockfuncs . attr_le ( self . obj2 , self . obj1 , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertEquals ( False , lockfuncs . attr_ne ( self . obj2 , self . obj1 , '<STR_LIT>' , '<STR_LIT>' ) ) </s>
