def test_min_succeeds(self): from AccessControl.ZopeGuards import guarded_min sm = SecurityManager() # accepts old = self.setSecurityManager(sm) self.assertEqual(guarded_min([1,2,3]), 1) self.assertEqual(guarded_min(1,2,3), 1) if MIN_MAX_TAKE_KEY: class MyDict(dict): # guard() skips 'dict' values pass self.assertEqual(guarded_min(MyDict(x=1), MyDict(x=2), key=operator.itemgetter('x')), {'x':1}) self.setSecurityManager(old)
def test_min_succeeds(self): sm = SecurityManager() # accepts old = self.setSecurityManager(sm) self.assertEqual(guarded_min([1,2,3]), 1) self.assertEqual(guarded_min(1,2,3), 1) self.setSecurityManager(old)