Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(3)  |  Derive(0)  |  Import(2)

        def guarded_min(item, *items, **kw):
    if items:
        item = [item]
        item.extend(items)
    return min(guarded_iter(item), **kw)
        


src/a/c/AccessControl-3.0.8/src/AccessControl/tests/testZopeGuards.py   AccessControl(Download)
    def test_min_fails(self):
        from AccessControl import Unauthorized
        from AccessControl.ZopeGuards import guarded_min
        sm = SecurityManager(1) # rejects
        old = self.setSecurityManager(sm)
    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),